factor out shared "compute-merged-cw" routine
This commit is contained in:
parent
e60fe879d6
commit
b2d43040b1
13 changed files with 41 additions and 96 deletions
|
|
@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts" setup>
|
||||
import { watch, ref, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { appendContentWarning } from '@@/js/append-content-warning.js';
|
||||
import { computeMergedCw } from '@@/js/compute-merged-cw.js';
|
||||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||
import MkCwButton from '@/components/MkCwButton.vue';
|
||||
|
|
@ -38,13 +38,7 @@ 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;
|
||||
});
|
||||
const mergedCW = computed(() => computeMergedCw(props.note));
|
||||
|
||||
watch(() => props.expandAllCws, (expandAllCws) => {
|
||||
if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue