Skip to content

Commit

Permalink
Feat: 리액션 뷰어에서도 이모지를 가져올 수 있음
Browse files Browse the repository at this point in the history
test

test

test

test

test

test

test

test

test

test

test
  • Loading branch information
noridev committed Dec 21, 2023
1 parent 70f8e7b commit 709ef01
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions packages/frontend/src/components/MkReactionsViewer.reaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) }"
>
<MkReactionIcon :class="defaultStore.state.limitWidthOfReaction ? $style.limitWidth : ''" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]" @click="toggleReaction"/>
<MkReactionIcon :class="defaultStore.state.limitWidthOfReaction ? $style.limitWidth : ''" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]" @click.stop="(ev) => { canToggle || alternative ? toggleReaction(ev) : stealReaction(ev) }"/>
<span :class="$style.count">{{ count }}</span>
</button>
</template>
Expand Down Expand Up @@ -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}:`,
});
}
});
Expand All @@ -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;
Expand Down

0 comments on commit 709ef01

Please sign in to comment.