diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-03-31 14:53:02 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-03-31 14:53:02 -0400 |
| commit | c371af34e877845e01cd92683aca0ff3334e314a (patch) | |
| tree | e34c80fc5c134a87f6ce01cbd93d6163c08c0a7d /packages/frontend/src/components/MkNoteDetailed.vue | |
| parent | regenerate misskey-js (diff) | |
| download | sharkey-c371af34e877845e01cd92683aca0ff3334e314a.tar.gz sharkey-c371af34e877845e01cd92683aca0ff3334e314a.tar.bz2 sharkey-c371af34e877845e01cd92683aca0ff3334e314a.zip | |
copy sharkey settings into new frontend preferences model
Diffstat (limited to 'packages/frontend/src/components/MkNoteDetailed.vue')
| -rw-r--r-- | packages/frontend/src/components/MkNoteDetailed.vue | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index fe911a1293..42defb69a8 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -112,7 +112,7 @@ SPDX-License-Identifier: AGPL-3.0-only </div> </div> <MkButton v-if="!allowAnim && animated" :class="$style.playMFMButton" :small="true" @click="animatedMFM()" @click.stop><i class="ph-play ph-bold ph-lg "></i> {{ i18n.ts._animatedMFM.play }}</MkButton> - <MkButton v-else-if="!defaultStore.state.animatedMfm && allowAnim && animated" :class="$style.playMFMButton" :small="true" @click="animatedMFM()" @click.stop><i class="ph-stop ph-bold ph-lg "></i> {{ i18n.ts._animatedMFM.stop }}</MkButton> + <MkButton v-else-if="!prefer.s.animatedMfm && allowAnim && animated" :class="$style.playMFMButton" :small="true" @click="animatedMFM()" @click.stop><i class="ph-stop ph-bold ph-lg "></i> {{ i18n.ts._animatedMFM.stop }}</MkButton> <div v-if="appearNote.files && appearNote.files.length > 0"> <MkMediaList ref="galleryEl" :mediaList="appearNote.files"/> </div> @@ -241,7 +241,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { computed, inject, onMounted, provide, ref, useTemplateRef } from 'vue'; +import { computed, inject, onMounted, provide, ref, useTemplateRef, watch } from 'vue'; import * as mfm from '@transfem-org/sfm-js'; import * as Misskey from 'misskey-js'; import { isLink } from '@@/js/is-link.js'; @@ -285,7 +285,8 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue'; import MkPagination from '@/components/MkPagination.vue'; import MkReactionIcon from '@/components/MkReactionIcon.vue'; import MkButton from '@/components/MkButton.vue'; -import { boostMenuItems, type Visibility, computeRenoteTooltip } from '@/utility/boost-quote.js'; +import { boostMenuItems, computeRenoteTooltip } from '@/utility/boost-quote.js'; +import type { Visibility } from '@/utility/boost-quote.js'; import { isEnabledUrlPreview } from '@/instance.js'; import { getAppearNote } from '@/utility/get-appear-note.js'; import { prefer } from '@/preferences.js'; @@ -338,7 +339,7 @@ const likeButton = useTemplateRef('likeButton'); const appearNote = computed(() => getAppearNote(note.value)); const galleryEl = useTemplateRef('galleryEl'); const isMyRenote = $i && ($i.id === note.value.userId); -const showContent = ref(defaultStore.state.uncollapseCW); +const showContent = ref(prefer.s.uncollapseCW); const isDeleted = ref(false); const renoted = ref(false); const muted = ref($i ? checkWordMute(appearNote.value, $i, $i.mutedWords) : false); @@ -353,7 +354,7 @@ const conversation = ref<Misskey.entities.Note[]>([]); const replies = ref<Misskey.entities.Note[]>([]); const quotes = ref<Misskey.entities.Note[]>([]); const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id)); -const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null); +const defaultLike = computed(() => prefer.s.like ? prefer.s.like : null); const mergedCW = computed(() => computeMergedCw(appearNote.value)); @@ -383,7 +384,7 @@ const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({ const keymap = { 'r': () => reply(), 'e|a|plus': () => react(), - 'q': () => { if (canRenote.value && !renoted.value && !renoting) renote(defaultStore.state.visibilityOnBoost); }, + 'q': () => { if (canRenote.value && !renoted.value && !renoting) renote(prefer.s.visibilityOnBoost); }, 'm': () => showMenu(), 'c': () => { if (!prefer.s.showClipButtonInNoteFooter) return; @@ -494,8 +495,8 @@ useTooltip(quoteButton, async (showing) => { function boostVisibility(forceMenu: boolean = false) { if (renoting) return; - if (!defaultStore.state.showVisibilitySelectorOnBoost && !forceMenu) { - renote(defaultStore.state.visibilityOnBoost); + if (!prefer.s.showVisibilitySelectorOnBoost && !forceMenu) { + renote(prefer.s.visibilityOnBoost); } else { os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value); } @@ -531,7 +532,7 @@ function renote(visibility: Visibility, localOnly: boolean = false) { renoting = true; - if (appearNote.value.channel) { + if (appearNote.value.channel && !appearNote.value.channel.allowRenoteToExternal) { const el = renoteButton.value as HTMLElement | null | undefined; if (el) { const rect = el.getBoundingClientRect(); @@ -549,7 +550,7 @@ function renote(visibility: Visibility, localOnly: boolean = false) { os.toast(i18n.ts.renoted); renoted.value = true; }).finally(() => { renoting = false; }); - } else if (!appearNote.value.channel || appearNote.value.channel.allowRenoteToExternal) { + } else { const el = renoteButton.value as HTMLElement | null | undefined; if (el) { const rect = el.getBoundingClientRect(); @@ -748,18 +749,18 @@ function onContextmenu(ev: MouseEvent): void { ev.preventDefault(); react(); } else { - const { menu, cleanup } = getNoteMenu({ note: note.value, translating, translation, isDeleted }); - os.contextMenu(menu, ev).then(focus).finally(cleanup); + const { popupMenu, cleanup } = getNoteMenu({ note: note.value, translating, translation, isDeleted }); + os.contextMenu(popupMenu, ev).then(focus).finally(cleanup); } } function showMenu(): void { - const { menu, cleanup } = getNoteMenu({ note: note.value, translating, translation, isDeleted }); - os.popupMenu(menu, menuButton.value).then(focus).finally(cleanup); + const { popupMenu, cleanup } = getNoteMenu({ note: note.value, translating, translation, isDeleted }); + os.popupMenu(popupMenu, menuButton.value).then(focus).finally(cleanup); } async function menuVersions(): Promise<void> { - const { menu, cleanup } = await getNoteVersionsMenu({ note: note.value, menuVersionsButton }); + const { menu, cleanup } = await getNoteVersionsMenu({ note: note.value, menuButton: menuVersionsButton }); os.popupMenu(menu, menuVersionsButton.value).then(focus).finally(cleanup); } @@ -833,7 +834,7 @@ function loadConversation() { }); } -if (appearNote.value.reply && appearNote.value.reply.replyId && defaultStore.state.autoloadConversation) loadConversation(); +if (appearNote.value.reply && appearNote.value.reply.replyId && prefer.s.autoloadConversation) loadConversation(); function animatedMFM() { if (allowAnim.value) { |