From af730e75b6fc1a57ca680ce83459d7e433b130cf Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 2 Oct 2023 22:31:04 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20strange=20heart=20reactio?= =?UTF-8?q?n=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/misc/reaction-lib.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index 77524057d..db88b0590 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -4,11 +4,6 @@ import { Emojis } from "@/models/index.js"; import { toPunyNullable } from "./convert-host.js"; import { IsNull } from "typeorm"; -export async function getFallbackReaction() { - const meta = await fetchMeta(); - return meta.defaultReaction; -} - export function convertReactions(reactions: Record) { const result = new Map(); @@ -26,11 +21,11 @@ export async function toDbReaction( reaction?: string | null, reacterHost?: string | null, ): Promise { - if (!reaction) return await getFallbackReaction(); + if (!reaction) return (await fetchMeta()).defaultReaction; reacterHost = toPunyNullable(reacterHost); - if (reaction === "♥️") return "❤️"; + if (reaction.includes("❤") || reaction.includes("♥️")) return "❤️"; // Allow unicode reactions const match = emojiRegex.exec(reaction); @@ -50,7 +45,7 @@ export async function toDbReaction( if (emoji) return reacterHost ? `:${name}@${reacterHost}:` : `:${name}:`; } - return await getFallbackReaction(); + return (await fetchMeta()).defaultReaction; } type DecodedReaction = {