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
|
|
@ -46,11 +46,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<EmNoteHeader :note="appearNote" :mini="true"/>
|
||||
<EmInstanceTicker v-if="appearNote.user.instance != null" :instance="appearNote.user.instance"/>
|
||||
<div style="container-type: inline-size;">
|
||||
<p v-if="appearNote.cw != null" :class="$style.cw">
|
||||
<EmMfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="'respect'" :isBlock="true"/>
|
||||
<p v-if="mergedCW != null" :class="$style.cw">
|
||||
<EmMfm v-if="mergedCW != ''" style="margin-right: 8px;" :text="mergedCW" :author="appearNote.user" :nyaize="'respect'" :isBlock="true"/>
|
||||
<button style="display: block; width: 100%; margin: 4px 0;" class="_buttonGray _buttonRounded" @click="showContent = !showContent">{{ showContent ? i18n.ts._cw.hide : i18n.ts._cw.show }}</button>
|
||||
</p>
|
||||
<div v-show="appearNote.cw == null || showContent" :class="[{ [$style.contentCollapsed]: collapsed }]">
|
||||
<div v-show="mergedCW == null || showContent" :class="[{ [$style.contentCollapsed]: collapsed }]">
|
||||
<div :class="$style.text">
|
||||
<span v-if="appearNote.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
|
||||
<EmA v-if="appearNote.replyId" :class="$style.replyIcon" :to="`/notes/${appearNote.replyId}`"><i class="ti ti-arrow-back-up"></i></EmA>
|
||||
|
|
@ -109,6 +109,7 @@ import * as mfm from '@transfem-org/sfm-js';
|
|||
import * as Misskey from 'misskey-js';
|
||||
import { shouldCollapsed } from '@@/js/collapsed.js';
|
||||
import { url } from '@@/js/config.js';
|
||||
import { appendContentWarning } from '@@/js/append-content-warning.js';
|
||||
import I18n from '@/components/I18n.vue';
|
||||
import EmNoteSub from '@/components/EmNoteSub.vue';
|
||||
import EmNoteHeader from '@/components/EmNoteHeader.vue';
|
||||
|
|
@ -154,6 +155,14 @@ const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value
|
|||
const isLong = shouldCollapsed(appearNote.value, []);
|
||||
const collapsed = ref(appearNote.value.cw == null && isLong);
|
||||
const isDeleted = ref(false);
|
||||
|
||||
const mergedCW = computed(() => {
|
||||
let cw = appearNote.value.cw;
|
||||
if (appearNote.value.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, appearNote.value.user.mandatoryCW);
|
||||
}
|
||||
return cw;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
</header>
|
||||
<div :class="[$style.noteContent, { [$style.contentCollapsed]: collapsed }]">
|
||||
<p v-if="appearNote.cw != null" :class="$style.cw">
|
||||
<EmMfm v-if="appearNote.cw != ''" style="margin-right: 8px;" :text="appearNote.cw" :author="appearNote.user" :nyaize="'respect'" :isBlock="true"/>
|
||||
<p v-if="mergedCW != null" :class="$style.cw">
|
||||
<EmMfm v-if="mergedCW != ''" style="margin-right: 8px;" :text="mergedCW" :author="appearNote.user" :nyaize="'respect'" :isBlock="true"/>
|
||||
<button style="display: block; width: 100%; margin: 4px 0;" class="_buttonGray _buttonRounded" @click="showContent = !showContent">{{ showContent ? i18n.ts._cw.hide : i18n.ts._cw.show }}</button>
|
||||
</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>
|
||||
<EmA v-if="appearNote.replyId" :class="$style.noteReplyTarget" :to="`/notes/${appearNote.replyId}`"><i class="ti ti-arrow-back-up"></i></EmA>
|
||||
<EmMfm
|
||||
|
|
@ -130,6 +130,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
import { computed, inject, ref } from 'vue';
|
||||
import * as mfm from '@transfem-org/sfm-js';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { appendContentWarning } from '@@/js/append-content-warning.js';
|
||||
import I18n from '@/components/I18n.vue';
|
||||
import EmMediaList from '@/components/EmMediaList.vue';
|
||||
import EmNoteSub from '@/components/EmNoteSub.vue';
|
||||
|
|
@ -175,6 +176,14 @@ const isDeleted = ref(false);
|
|||
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
|
||||
const isLong = shouldCollapsed(appearNote.value, []);
|
||||
const collapsed = ref(appearNote.value.cw == null && isLong);
|
||||
|
||||
const mergedCW = computed(() => {
|
||||
let cw = appearNote.value.cw;
|
||||
if (appearNote.value.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, appearNote.value.user.mandatoryCW);
|
||||
}
|
||||
return cw;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div :class="$style.main">
|
||||
<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'" :emojiUrls="note.emojis" :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'" :emojiUrls="note.emojis" :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>
|
||||
|
|
@ -22,8 +22,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 { i18n } from '@/i18n.js';
|
||||
import EmAvatar from '@/components/EmAvatar.vue';
|
||||
import EmNoteHeader from '@/components/EmNoteHeader.vue';
|
||||
|
|
@ -35,6 +36,14 @@ const props = defineProps<{
|
|||
}>();
|
||||
|
||||
const showContent = ref(false);
|
||||
|
||||
const mergedCW = computed(() => {
|
||||
let cw = props.note.cw;
|
||||
if (props.note.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, props.note.user.mandatoryCW);
|
||||
}
|
||||
return cw;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
|||
|
|
@ -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