From 5db6cab3fd28e1863a9125b5f6dac596c2201fef Mon Sep 17 00:00:00 2001 From: mappi-pr Date: Fri, 7 Jul 2023 11:34:27 +0900 Subject: [PATCH 1/3] wip --- packages/frontend/src/components/MkNote.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 7c9ddadbf8..54cb0e841e 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -104,13 +104,14 @@ - - + From ebec0725f535c7604f1be63315f9314d0882a2cb Mon Sep 17 00:00:00 2001 From: mappi-pr Date: Fri, 7 Jul 2023 13:46:47 +0900 Subject: [PATCH 2/3] wip --- packages/frontend/src/components/MkNote.vue | 38 +++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 54cb0e841e..3e1f90eebb 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -359,19 +359,43 @@ function react(viaKeyboard = false): void { } else { blur(); reactionPicker.show(reactButton.value, reaction => { - os.api('notes/reactions/create', { - noteId: appearNote.id, - reaction: reaction, - }); - if (appearNote.text && appearNote.text.length > 100 && (Date.now() - new Date(appearNote.createdAt).getTime() < 1000 * 3)) { - claimAchievement('reactWithoutRead'); - } + toggleReaction(reaction); }, () => { focus(); }); } } +async function toggleReaction(reaction) { + const oldReaction = note.myReaction; + if (oldReaction) { + const confirm = await os.confirm({ + type: 'warning', + text: oldReaction !== reaction ? i18n.ts.changeReactionConfirm : i18n.ts.cancelReactionConfirm, + }); + if (confirm.canceled) return; + + os.api('notes/reactions/delete', { + noteId: note.id, + }).then(() => { + if (oldReaction !== reaction) { + os.api('notes/reactions/create', { + noteId: note.id, + reaction: reaction, + }); + } + }); + } else { + os.api('notes/reactions/create', { + noteId: appearNote.id, + reaction: reaction, + }); + } + if (appearNote.text && appearNote.text.length > 100 && (Date.now() - new Date(appearNote.createdAt).getTime() < 1000 * 3)) { + claimAchievement('reactWithoutRead'); + } +} + function undoReact(note): void { const oldReaction = note.myReaction; if (!oldReaction) return; From e514c801b71721fb99b4e1f1c0c70d3230b6aab6 Mon Sep 17 00:00:00 2001 From: mappi-pr Date: Fri, 7 Jul 2023 14:24:21 +0900 Subject: [PATCH 3/3] feat 11055 --- CHANGELOG.md | 1 + packages/frontend/src/components/MkNote.vue | 1 - .../src/components/MkNoteDetailed.vue | 48 ++++++++++++++----- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a366729e4b..77b4f40a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - ドライブファイルのメニューで画像をクロップできるように - 画像を動画と同様に簡単に隠せるように - オリジナル画像を保持せずにアップロードする場合webpでアップロードされるように(Safari以外) +- ノートのリアクションボタンのアイコンを変更し、削除をせずにリアクションを変更できるように ### Server - JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 3e1f90eebb..a622e5c7ae 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -111,7 +111,6 @@ - diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index a65039277b..6f30f3e9ff 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -105,12 +105,12 @@ - -