append mandatory CW in all note views (Mk/Sk/Em + basic/Detailed/Simple/Sub)
This commit is contained in:
parent
c5933f369e
commit
905b637648
12 changed files with 152 additions and 44 deletions
|
|
@ -9,11 +9,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div :class="$style.main">
|
||||
<MkNoteHeader :class="$style.header" :classic="true" :note="note" :mini="true"/>
|
||||
<div>
|
||||
<p v-if="note.cw != null" :class="$style.cw">
|
||||
<Mfm v-if="note.cw != ''" style="margin-right: 8px;" :text="note.cw" :isBlock="true" :author="note.user" :nyaize="'respect'" :emojiUrls="note.emojis"/>
|
||||
<p v-if="mergedCW != null" :class="$style.cw">
|
||||
<Mfm v-if="mergedCW != ''" style="margin-right: 8px;" :text="mergedCW" :isBlock="true" :author="note.user" :nyaize="'respect'" :emojiUrls="note.emojis"/>
|
||||
<MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll" @click.stop/>
|
||||
</p>
|
||||
<div v-show="note.cw == null || showContent">
|
||||
<div v-show="mergedCW == null || showContent">
|
||||
<MkSubNoteContent :hideFiles="hideFiles" :class="$style.text" :note="note" :expandAllCws="props.expandAllCws"/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,8 +22,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, ref } from 'vue';
|
||||
import { watch, ref, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { appendContentWarning } from '@@/js/append-content-warning.js';
|
||||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||
import MkCwButton from '@/components/MkCwButton.vue';
|
||||
|
|
@ -37,6 +38,14 @@ const props = defineProps<{
|
|||
|
||||
let showContent = ref(defaultStore.state.uncollapseCW);
|
||||
|
||||
const mergedCW = computed(() => {
|
||||
let cw = props.note.cw;
|
||||
if (props.note.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, props.note.user.mandatoryCW);
|
||||
}
|
||||
return cw;
|
||||
});
|
||||
|
||||
watch(() => props.expandAllCws, (expandAllCws) => {
|
||||
if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue