From f1e0db1672d07be4af446d5cad3d6e3bbea0fffc Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 28 Jan 2022 01:05:31 +0900 Subject: [PATCH] =?UTF-8?q?fix(client):=20=E6=8A=95=E7=A8=BF=E3=81=AENSFW?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=82=E3=81=A8=E3=81=AB=E3=83=AA=E3=82=A2=E3=82=AF=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=8C=E6=9B=B4=E6=96=B0=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=81=A8=E7=94=BB=E5=83=8F=E3=81=8C=E9=9D=9E=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=AB=E3=81=AA=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #8208 --- CHANGELOG.md | 7 +++++ .../client/src/scripts/use-note-capture.ts | 28 +++++-------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cabb4ad46..f60cbd129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ --> +## 12.x.x (unreleased) + +### Improvements + +### Bugfixes +- 投稿のNSFW画像を表示したあとにリアクションが更新されると画像が非表示になる問題を修正 + ## 12.102.1 (2022/01/27) ### Bugfixes - チャットが表示できない問題を修正 diff --git a/packages/client/src/scripts/use-note-capture.ts b/packages/client/src/scripts/use-note-capture.ts index bb00e464e..b7cf99d5e 100644 --- a/packages/client/src/scripts/use-note-capture.ts +++ b/packages/client/src/scripts/use-note-capture.ts @@ -19,51 +19,41 @@ export function useNoteCapture(props: { case 'reacted': { const reaction = body.reaction; - const updated = JSON.parse(JSON.stringify(appearNote.value)); - if (body.emoji) { const emojis = appearNote.value.emojis || []; if (!emojis.includes(body.emoji)) { - updated.emojis = [...emojis, body.emoji]; + appearNote.value.emojis = [...emojis, body.emoji]; } } // TODO: reactionsプロパティがない場合ってあったっけ? なければ || {} は消せる const currentCount = (appearNote.value.reactions || {})[reaction] || 0; - updated.reactions[reaction] = currentCount + 1; + appearNote.value.reactions[reaction] = currentCount + 1; if ($i && (body.userId === $i.id)) { - updated.myReaction = reaction; + appearNote.value.myReaction = reaction; } - - appearNote.value = updated; break; } case 'unreacted': { const reaction = body.reaction; - const updated = JSON.parse(JSON.stringify(appearNote.value)); - // TODO: reactionsプロパティがない場合ってあったっけ? なければ || {} は消せる const currentCount = (appearNote.value.reactions || {})[reaction] || 0; - updated.reactions[reaction] = Math.max(0, currentCount - 1); + appearNote.value.reactions[reaction] = Math.max(0, currentCount - 1); if ($i && (body.userId === $i.id)) { - updated.myReaction = null; + appearNote.value.myReaction = null; } - - appearNote.value = updated; break; } case 'pollVoted': { const choice = body.choice; - const updated = JSON.parse(JSON.stringify(appearNote.value)); - const choices = [...appearNote.value.poll.choices]; choices[choice] = { ...choices[choice], @@ -73,16 +63,12 @@ export function useNoteCapture(props: { } : {}) }; - updated.poll.choices = choices; - - appearNote.value = updated; + appearNote.value.poll.choices = choices; break; } case 'deleted': { - const updated = JSON.parse(JSON.stringify(appearNote.value)); - updated.value = true; - appearNote.value = updated; + appearNote.value.deletedAt = new Date(); break; } }