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
|
|
@ -11,11 +11,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div :class="$style.body">
|
||||
<EmNoteHeader :class="$style.header" :note="note" :mini="true"/>
|
||||
<div>
|
||||
<p v-if="note.cw != null" :class="$style.cw">
|
||||
<EmMfm v-if="note.cw != ''" style="margin-right: 8px;" :text="note.cw" :author="note.user" :nyaize="'respect'" :isBlock="true"/>
|
||||
<p v-if="mergedCW != null" :class="$style.cw">
|
||||
<EmMfm v-if="mergedCW != ''" style="margin-right: 8px;" :text="mergedCW" :author="note.user" :nyaize="'respect'" :isBlock="true"/>
|
||||
<button style="display: block; width: 100%;" class="_buttonGray _buttonRounded" @click="showContent = !showContent">{{ showContent ? i18n.ts._cw.hide : i18n.ts._cw.show }}</button>
|
||||
</p>
|
||||
<div v-show="note.cw == null || showContent">
|
||||
<div v-show="mergedCW == null || showContent">
|
||||
<EmSubNoteContent :class="$style.text" :note="note"/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -31,8 +31,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { appendContentWarning } from '@@/js/append-content-warning.js';
|
||||
import EmA from '@/components/EmA.vue';
|
||||
import EmAvatar from '@/components/EmAvatar.vue';
|
||||
import EmNoteHeader from '@/components/EmNoteHeader.vue';
|
||||
|
|
@ -55,6 +56,14 @@ const props = withDefaults(defineProps<{
|
|||
const showContent = ref(false);
|
||||
const replies = ref<Misskey.entities.Note[]>([]);
|
||||
|
||||
const mergedCW = computed(() => {
|
||||
let cw = props.note.cw;
|
||||
if (props.note.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, props.note.user.mandatoryCW);
|
||||
}
|
||||
return cw;
|
||||
});
|
||||
|
||||
if (props.detail) {
|
||||
misskeyApi('notes/children', {
|
||||
noteId: props.note.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue