From 709ef019450bb55b5bef2585b34f870c2eba1f86 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Thu, 21 Dec 2023 16:39:04 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=A6=AC=EC=95=A1=EC=85=98=20=EB=B7=B0?= =?UTF-8?q?=EC=96=B4=EC=97=90=EC=84=9C=EB=8F=84=20=EC=9D=B4=EB=AA=A8?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EA=B0=80=EC=A0=B8=EC=98=AC=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test test test test test test test test test test test --- .../components/MkReactionsViewer.reaction.vue | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue index 6bd1a6e004..103437d310 100644 --- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue +++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue @@ -10,9 +10,9 @@ SPDX-License-Identifier: AGPL-3.0-only v-vibrate="defaultStore.state.vibrateSystem ? [10, 30, 40] : []" class="_button" :class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: (canToggle || alternative), [$style.small]: defaultStore.state.reactionsDisplaySize === 'small', [$style.large]: defaultStore.state.reactionsDisplaySize === 'large' }]" - @click="toggleReaction" + @click.stop="(ev) => { canToggle || alternative ? toggleReaction(ev) : stealReaction(ev) }" > - + {{ count }} @@ -87,7 +87,7 @@ async function toggleReaction(ev: MouseEvent) { if (oldReaction !== props.reaction) { os.api('notes/reactions/create', { noteId: props.note.id, - reaction: props.reaction, + reaction: `:${reactionName.value}:`, }); } }); @@ -109,6 +109,38 @@ async function toggleReaction(ev: MouseEvent) { } } +function stealReaction(ev: MouseEvent) { + if (props.note.user.host && $i && ($i.isAdmin ?? $i.policies.canManageCustomEmojis)) { + os.popupMenu([{ + type: 'label', + text: props.reaction, + }, { + text: i18n.ts.import, + icon: 'ti ti-plus', + action: async () => { + await os.apiWithDialog('admin/emoji/steal', { + name: reactionName.value, + host: props.note.user.host, + }); + }, + }, { + text: i18n.ts.doReaction, + icon: 'ti ti-mood-plus', + action: async () => { + await os.apiWithDialog('admin/emoji/steal', { + name: reactionName.value, + host: props.note.user.host, + }); + + await os.api('notes/reactions/create', { + noteId: props.note.id, + reaction: `:${reactionName.value}:`, + }); + }, + }], ev.currentTarget ?? ev.target); + } +} + function anime() { if (document.hidden) return; if (!defaultStore.state.animation) return;