From 48d4b5a72612bd8e193decce05295e1e76b10873 Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Sat, 4 Feb 2023 02:30:43 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Use=20=E2=9D=A4=EF=B8=8F=20instead=20of?= =?UTF-8?q?=20=E2=99=A5=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/misc/reaction-lib.ts | 17 +++++++++-------- packages/client/src/emojilist.json | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index c0a5e8e2f..5fd47aab7 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -35,6 +35,12 @@ export function convertLegacyReactions(reactions: Record) { } else { _reactions[legacies[reaction]] = reactions[reaction]; } + } else if (reaction === "♥️") { + if (_reactions["❤️"]) { + _reactions["❤️"] += reactions[reaction]; + } else { + _reactions["❤️"] = reactions[reaction]; + } } else { if (_reactions[reaction]) { _reactions[reaction] += reactions[reaction]; @@ -61,15 +67,10 @@ export async function toDbReaction( reacterHost = toPunyNullable(reacterHost); - // 文字列タイプのリアクションを絵文字に変換 + // Convert string-type reactions to unicode if (Object.keys(legacies).includes(reaction)) return legacies[reaction]; - - // Unicode絵文字 - const match = emojiRegex.exec(reaction); - if (match) { - const unicode = match[0]; - return unicode.match("\u200d") ? unicode : unicode.replace(/\ufe0f/g, ""); - } + // Convert old heart to new + if (reaction === "♥️") return "❤️"; const custom = reaction.match(/^:([\w+-]+)(?:@\.)?:$/); if (custom) { diff --git a/packages/client/src/emojilist.json b/packages/client/src/emojilist.json index b1b5ae59c..78390a7be 100644 --- a/packages/client/src/emojilist.json +++ b/packages/client/src/emojilist.json @@ -1496,7 +1496,7 @@ { "category": "symbols", "char": "🀄", "name": "mahjong", "keywords": ["game", "play", "chinese", "kanji"] }, { "category": "symbols", "char": "♠️", "name": "spades", "keywords": ["poker", "cards", "suits", "magic"] }, { "category": "symbols", "char": "♣️", "name": "clubs", "keywords": ["poker", "cards", "magic", "suits"] }, - { "category": "symbols", "char": "♥️", "name": "hearts", "keywords": ["poker", "cards", "magic", "suits"] }, + { "category": "symbols", "char": "❤️", "name": "hearts", "keywords": ["poker", "cards", "magic", "suits"] }, { "category": "symbols", "char": "♦️", "name": "diamonds", "keywords": ["poker", "cards", "magic", "suits"] }, { "category": "symbols", "char": "🎴", "name": "flower_playing_cards", "keywords": ["game", "sunset", "red"] }, { "category": "symbols", "char": "💭", "name": "thought_balloon", "keywords": ["bubble", "cloud", "speech", "thinking", "dream"] },