From dd736b8990e6330981d60e89e22781bba7c43676 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih Date: Tue, 31 Oct 2023 20:46:03 +0900 Subject: [PATCH] (fix) reactionViewer mock --- packages/frontend/src/components/MkNote.vue | 2 +- .../components/MkReactionsViewer.reaction.vue | 37 ++++++++++--------- .../src/components/MkReactionsViewer.vue | 4 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index d8a8aa39c0..0319eb61d6 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -84,7 +84,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ appearNote.channel.name }} - + diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue index d0db515219..5dc19db85f 100644 --- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue +++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue @@ -34,6 +34,7 @@ const props = defineProps<{ count: number; isInitial: boolean; note: Misskey.entities.Note; + mock?: boolean; }>(); const buttonEl = shallowRef(); @@ -51,7 +52,7 @@ async function toggleReaction() { type: 'warning', text: oldReaction !== props.reaction ? i18n.ts.changeReactionConfirm : i18n.ts.cancelReactionConfirm, }); - if (confirm.canceled) return; + if (confirm.canceled || props.mock) return; os.api('notes/reactions/delete', { noteId: props.note.id, @@ -92,24 +93,26 @@ onMounted(() => { if (!props.isInitial) anime(); }); -useTooltip(buttonEl, async (showing) => { - const reactions = await os.apiGet('notes/reactions', { - noteId: props.note.id, - type: props.reaction, - limit: 11, - _cacheKey_: props.count, - }); +if (!props.mock) { + useTooltip(buttonEl, async (showing) => { + const reactions = await os.apiGet('notes/reactions', { + noteId: props.note.id, + type: props.reaction, + limit: 11, + _cacheKey_: props.count, + }); - const users = reactions.map(x => x.user); + const users = reactions.map(x => x.user); - os.popup(XDetails, { - showing, - reaction: props.reaction, - users, - count: props.count, - targetElement: buttonEl.value, - }, {}, 'closed'); -}, 100); + os.popup(XDetails, { + showing, + reaction: props.reaction, + users, + count: props.count, + targetElement: buttonEl.value, + }, {}, 'closed'); + }, 100); +}