From 5bdbff19ae4feaa39b0d3241c233236bfcd3179e Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sun, 1 Jun 2025 08:10:49 +0900 Subject: fix(frontend): リアクションの一部の絵文字が重複して表示されることがある問題を修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #16130 --- packages/frontend/src/composables/use-note-capture.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'packages/frontend/src') diff --git a/packages/frontend/src/composables/use-note-capture.ts b/packages/frontend/src/composables/use-note-capture.ts index 90a5922b3e..2aeb9074e5 100644 --- a/packages/frontend/src/composables/use-note-capture.ts +++ b/packages/frontend/src/composables/use-note-capture.ts @@ -194,9 +194,9 @@ export function useNoteCapture(props: { parentNote: Misskey.entities.Note | null; mock?: boolean; }): { - $note: Reactive; - subscribe: () => void; -} { + $note: Reactive; + subscribe: () => void; + } { const { note, parentNote, mock } = props; const $note = reactive({ @@ -225,8 +225,8 @@ export function useNoteCapture(props: { let latestPollVotedKey: string | null = null; function onReacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void { - const normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); - + let normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); + normalizedName = normalizedName.match('\u200d') ? normalizedName : normalizedName.replace(/\ufe0f/g, ''); if (reactionUserMap.has(ctx.userId) && reactionUserMap.get(ctx.userId) === normalizedName) return; reactionUserMap.set(ctx.userId, normalizedName); @@ -245,7 +245,8 @@ export function useNoteCapture(props: { } function onUnreacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void { - const normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); + let normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); + normalizedName = normalizedName.match('\u200d') ? normalizedName : normalizedName.replace(/\ufe0f/g, ''); // 確実に一度リアクションされて取り消されている場合のみ処理をとめる(APIで初回読み込み→Streamでアップデート等の場合、reactionUserMapに情報がないため) if (reactionUserMap.has(ctx.userId) && reactionUserMap.get(ctx.userId) === noReaction) return; -- cgit v1.2.3-freya