diff options
| author | 1Step621 <86859447+1STEP621@users.noreply.github.com> | 2024-02-06 16:45:21 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-06 16:45:21 +0900 |
| commit | 74245df3829622a3cc0c880ea710b5c1c4f5c584 (patch) | |
| tree | 3f6f4f1c598f4bd75be6bbfcd1d5deee8daa5adc /packages/frontend/src/components/MkReactionsViewer.reaction.vue | |
| parent | enhance(frontend): KeepAliveのページキャッシュを削除できるよ... (diff) | |
| download | misskey-74245df3829622a3cc0c880ea710b5c1c4f5c584.tar.gz misskey-74245df3829622a3cc0c880ea710b5c1c4f5c584.tar.bz2 misskey-74245df3829622a3cc0c880ea710b5c1c4f5c584.zip | |
Enhance(frontend): フロント側でもリアクション権限のチェックをするように (#13134)
* フロント側でもリアクション権限のチェックをするように
* update CHANGELOG.md
* lint fixes
* remove unrelated diffs
* deny -> reject
denyは「(信用しないことを理由に)拒否する」という意味らしい
* allow -> accept
* EmojiSimpleにlocalOnlyを含めるように
* リアクション権限のない絵文字は打てないように(ダイアログを出すのではなく)
* regenerate type definitions
* lint fix
* remove unused locales
* remove unnecessary async
Diffstat (limited to 'packages/frontend/src/components/MkReactionsViewer.reaction.vue')
| -rw-r--r-- | packages/frontend/src/components/MkReactionsViewer.reaction.vue | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/frontend/src/components/MkReactionsViewer.reaction.vue b/packages/frontend/src/components/MkReactionsViewer.reaction.vue index ffbf62a45c..67b448ccb7 100644 --- a/packages/frontend/src/components/MkReactionsViewer.reaction.vue +++ b/packages/frontend/src/components/MkReactionsViewer.reaction.vue @@ -32,6 +32,8 @@ import { claimAchievement } from '@/scripts/achievements.js'; import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import * as sound from '@/scripts/sound.js'; +import { checkReactionPermissions } from '@/scripts/check-reaction-permissions.js'; +import { customEmojis } from '@/custom-emojis.js'; const props = defineProps<{ reaction: string; @@ -48,13 +50,19 @@ const emit = defineEmits<{ const buttonEl = shallowRef<HTMLElement>(); -const canToggle = computed(() => !props.reaction.match(/@\w/) && $i); +const isCustomEmoji = computed(() => props.reaction.includes(':')); +const emoji = computed(() => isCustomEmoji.value ? customEmojis.value.find(emoji => emoji.name === props.reaction.replace(/:/g, '').replace(/@\./, '')) : null); + +const canToggle = computed(() => { + return !props.reaction.match(/@\w/) && $i + && (emoji.value && checkReactionPermissions($i, props.note, emoji.value)) + || !isCustomEmoji.value; +}); +const canGetInfo = computed(() => !props.reaction.match(/@\w/) && props.reaction.includes(':')); async function toggleReaction() { if (!canToggle.value) return; - // TODO: その絵文字を使う権限があるかどうか確認 - const oldReaction = props.note.myReaction; if (oldReaction) { const confirm = await os.confirm({ @@ -101,8 +109,8 @@ async function toggleReaction() { } async function menu(ev) { - if (!canToggle.value) return; - if (!props.reaction.includes(':')) return; + if (!canGetInfo.value) return; + os.popupMenu([{ text: i18n.ts.info, icon: 'ti ti-info-circle', |