summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkReactionsViewer.reaction.vue
diff options
context:
space:
mode:
authortaichan <40626578+tai-cha@users.noreply.github.com>2025-05-12 10:00:06 +0900
committerGitHub <noreply@github.com>2025-05-12 10:00:06 +0900
commit5bc52b6743d1d23d215aaa7b62ceee85f15c3502 (patch)
tree0426e5a239f65cadf8ad7a8f3a14dba6c7a68cd3 /packages/frontend/src/components/MkReactionsViewer.reaction.vue
parentlint (diff)
downloadmisskey-5bc52b6743d1d23d215aaa7b62ceee85f15c3502.tar.gz
misskey-5bc52b6743d1d23d215aaa7b62ceee85f15c3502.tar.bz2
misskey-5bc52b6743d1d23d215aaa7b62ceee85f15c3502.zip
feat(frontend): 絵文字をミュート可能にする機能 (#15966)
* wip ( 絵文字ミュートの基礎実装, PoC ) * refactor: 絵文字のmute/unmute処理の共通化 * SPDX * リアクションからも絵文字ミュート可能に * emojiMute/emojiUnmute * replace resource of emojiMute * add vitest preferstate for mutedEmojis * add vitest to preferReactive * 混入削除 * Fix typo (mutedEmojis -> mutingEmojis) * reactiveやめる * add時の判定ミスを修正 * Add CHANGELOG * Revert "reactiveやめる" This reverts commit 442742c371472f9c9e9372c5552cf73767aedecf. * Update Changelog
Diffstat (limited to 'packages/frontend/src/components/MkReactionsViewer.reaction.vue')
-rw-r--r--packages/frontend/src/components/MkReactionsViewer.reaction.vue65
1 files changed, 51 insertions, 14 deletions
diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue
index 9fc773b335..7d76dffa5a 100644
--- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue
+++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue
@@ -22,6 +22,7 @@ import { computed, inject, onMounted, useTemplateRef, watch } from 'vue';
import * as Misskey from 'misskey-js';
import { getUnicodeEmoji } from '@@/js/emojilist.js';
import MkCustomEmojiDetailedDialog from './MkCustomEmojiDetailedDialog.vue';
+import type { MenuItem } from '@/types/menu';
import XDetails from '@/components/MkReactionsViewer.details.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue';
import * as os from '@/os.js';
@@ -36,6 +37,7 @@ import { customEmojisMap } from '@/custom-emojis.js';
import { prefer } from '@/preferences.js';
import { DI } from '@/di.js';
import { noteEvents } from '@/composables/use-note-capture.js';
+import { mute as muteEmoji, unmute as unmuteEmoji, checkMuted as isEmojiMuted } from '@/utility/emoji-mute.js';
const props = defineProps<{
noteId: Misskey.entities.Note['id'];
@@ -63,6 +65,7 @@ const canToggle = computed(() => {
return !props.reaction.match(/@\w/) && $i && emoji.value;
});
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;
@@ -139,21 +142,55 @@ async function toggleReaction() {
}
async function menu(ev) {
- if (!canGetInfo.value) return;
+ let menuItems: MenuItem[] = [];
- os.popupMenu([{
- text: i18n.ts.info,
- icon: 'ti ti-info-circle',
- action: async () => {
- const { dispose } = os.popup(MkCustomEmojiDetailedDialog, {
- emoji: await misskeyApiGet('emoji', {
- name: props.reaction.replace(/:/g, '').replace(/@\./, ''),
- }),
- }, {
- closed: () => dispose(),
- });
- },
- }], ev.currentTarget ?? ev.target);
+ if (canGetInfo.value) {
+ menuItems.push({
+ text: i18n.ts.info,
+ icon: 'ti ti-info-circle',
+ action: async () => {
+ const { dispose } = os.popup(MkCustomEmojiDetailedDialog, {
+ emoji: await misskeyApiGet('emoji', {
+ name: props.reaction.replace(/:/g, '').replace(/@\./, ''),
+ }),
+ }, {
+ closed: () => dispose(),
+ });
+ },
+ });
+ }
+
+ if (isEmojiMuted(props.reaction).value) {
+ menuItems.push({
+ text: i18n.ts.emojiUnmute,
+ icon: 'ti ti-mood-smile',
+ action: () => {
+ os.confirm({
+ type: 'question',
+ title: i18n.tsx.unmuteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
+ }).then(({ canceled }) => {
+ if (canceled) return;
+ unmuteEmoji(props.reaction);
+ });
+ },
+ });
+ } else {
+ menuItems.push({
+ text: i18n.ts.emojiMute,
+ icon: 'ti ti-mood-off',
+ action: () => {
+ os.confirm({
+ type: 'question',
+ title: i18n.tsx.muteX({ x: isLocalCustomEmoji ? `:${emojiName.value}:` : props.reaction }),
+ }).then(({ canceled }) => {
+ if (canceled) return;
+ muteEmoji(props.reaction);
+ });
+ },
+ });
+ }
+
+ os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
}
function anime() {