diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-08-26 13:34:41 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-08-26 13:34:41 +0900 |
| commit | d6a1046361d3d38726f2a86588960c3614f72a9f (patch) | |
| tree | d0a501710c36b8e9488e6756adc906c08447910b /packages/frontend/src/components/MkReactionsViewer.reaction.vue | |
| parent | refactor and fix (diff) | |
| download | misskey-d6a1046361d3d38726f2a86588960c3614f72a9f.tar.gz misskey-d6a1046361d3d38726f2a86588960c3614f72a9f.tar.bz2 misskey-d6a1046361d3d38726f2a86588960c3614f72a9f.zip | |
refactor
Diffstat (limited to 'packages/frontend/src/components/MkReactionsViewer.reaction.vue')
| -rw-r--r-- | packages/frontend/src/components/MkReactionsViewer.reaction.vue | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue index e0490404ac..d96f0e2420 100644 --- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue +++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue @@ -58,18 +58,22 @@ const emit = defineEmits<{ const buttonEl = useTemplateRef('buttonEl'); const emojiName = computed(() => props.reaction.replace(/:/g, '').replace(/@\./, '')); -const emoji = computed(() => customEmojisMap.get(emojiName.value) ?? getUnicodeEmoji(props.reaction)); const canToggle = computed(() => { + const emoji = customEmojisMap.get(emojiName.value) ?? getUnicodeEmoji(props.reaction); + // TODO - //return !props.reaction.match(/@\w/) && $i && emoji.value && checkReactionPermissions($i, props.note, emoji.value); - return !props.reaction.match(/@\w/) && $i && emoji.value; + //return !props.reaction.match(/@\w/) && $i && emoji && checkReactionPermissions($i, props.note, emoji); + return !props.reaction.match(/@\w/) && $i && emoji; }); const canGetInfo = computed(() => !props.reaction.match(/@\w/) && props.reaction.includes(':')); const isLocalCustomEmoji = props.reaction[0] === ':' && props.reaction.includes('@.'); async function toggleReaction() { if (!canToggle.value) return; + if ($i == null) return; + + const me = $i; const oldReaction = props.myReaction; if (oldReaction) { @@ -93,7 +97,7 @@ async function toggleReaction() { noteId: props.noteId, }).then(() => { noteEvents.emit(`unreacted:${props.noteId}`, { - userId: $i!.id, + userId: me.id, reaction: oldReaction, }); if (oldReaction !== props.reaction) { @@ -101,10 +105,12 @@ async function toggleReaction() { noteId: props.noteId, reaction: props.reaction, }).then(() => { + const emoji = customEmojisMap.get(emojiName.value); + if (emoji == null) return; noteEvents.emit(`reacted:${props.noteId}`, { - userId: $i!.id, + userId: me.id, reaction: props.reaction, - emoji: emoji.value, + emoji: emoji, }); }); } @@ -131,10 +137,13 @@ async function toggleReaction() { noteId: props.noteId, reaction: props.reaction, }).then(() => { + const emoji = customEmojisMap.get(emojiName.value); + if (emoji == null) return; + noteEvents.emit(`reacted:${props.noteId}`, { - userId: $i!.id, + userId: me.id, reaction: props.reaction, - emoji: emoji.value, + emoji: emoji, }); }); // TODO: 上位コンポーネントでやる @@ -217,6 +226,8 @@ onMounted(() => { if (!mock) { useTooltip(buttonEl, async (showing) => { + if (buttonEl.value == null) return; + const reactions = await misskeyApiGet('notes/reactions', { noteId: props.noteId, type: props.reaction, |