append mandatory CW in all note views (Mk/Sk/Em + basic/Detailed/Simple/Sub)

This commit is contained in:
Hazelnoot 2025-02-12 14:47:17 -05:00
parent c5933f369e
commit 905b637648
12 changed files with 152 additions and 44 deletions

View file

@ -75,10 +75,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</header>
<div :class="$style.noteContent">
<p v-if="appearNote.cw != null" :class="$style.cw">
<p v-if="mergedCW != null" :class="$style.cw">
<Mfm
v-if="appearNote.cw != ''"
:text="appearNote.cw"
v-if="mergedCW != ''"
:text="mergedCW"
:author="appearNote.user"
:nyaize="'respect'"
:enableEmojiMenu="true"
@ -87,7 +87,7 @@ SPDX-License-Identifier: AGPL-3.0-only
/>
<MkCwButton v-model="showContent" :text="appearNote.text" :renote="appearNote.renote" :files="appearNote.files" :poll="appearNote.poll"/>
</p>
<div v-show="appearNote.cw == null || showContent">
<div v-show="mergedCW == null || showContent">
<span v-if="appearNote.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
<MkA v-if="appearNote.replyId" :class="$style.noteReplyTarget" :to="`/notes/${appearNote.replyId}`"><i class="ph-arrow-bend-left-up ph-bold ph-lg"></i></MkA>
<Mfm
@ -245,6 +245,7 @@ import * as mfm from '@transfem-org/sfm-js';
import * as Misskey from 'misskey-js';
import { isLink } from '@@/js/is-link.js';
import { host } from '@@/js/config.js';
import { appendContentWarning } from '@@/js/append-content-warning.js';
import MkNoteSub from '@/components/MkNoteSub.vue';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
@ -348,6 +349,14 @@ 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 mergedCW = computed(() => {
let cw = appearNote.value.cw;
if (appearNote.value.user.mandatoryCW) {
cw = appendContentWarning(cw, appearNote.value.user.mandatoryCW);
}
return cw;
});
const renoteTooltip = computeRenoteTooltip(renoted);
watch(() => props.expandAllCws, (expandAllCws) => {