refactor note mutes and render mandatoryCW as a mute
This commit is contained in:
parent
09a2280513
commit
54ad6438af
13 changed files with 304 additions and 329 deletions
|
|
@ -6,11 +6,11 @@ Detailed view of a note in the Sharkey style. Used when opening a note onto its
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="!muted && !threadMuted && !noteMuted"
|
||||
<SkMutedNote
|
||||
v-show="!isDeleted"
|
||||
ref="rootEl"
|
||||
ref="rootComp"
|
||||
v-hotkey="keymap"
|
||||
:note="appearNote"
|
||||
:class="$style.root"
|
||||
:tabindex="isDeleted ? '-1' : '0'"
|
||||
>
|
||||
|
|
@ -83,10 +83,10 @@ Detailed view of a note in the Sharkey style. Used when opening a note onto its
|
|||
</div>
|
||||
</header>
|
||||
<div :class="$style.noteContent">
|
||||
<p v-if="mergedCW != null" :class="$style.cw">
|
||||
<p v-if="appearNote.cw != null" :class="$style.cw">
|
||||
<Mfm
|
||||
v-if="mergedCW != ''"
|
||||
:text="mergedCW"
|
||||
v-if="appearNote.cw != ''"
|
||||
:text="appearNote.cw"
|
||||
:author="appearNote.user"
|
||||
:nyaize="'respect'"
|
||||
:enableEmojiMenu="true"
|
||||
|
|
@ -95,7 +95,7 @@ Detailed view of a note in the Sharkey style. Used when opening a note onto its
|
|||
/>
|
||||
<MkCwButton v-model="showContent" :text="appearNote.text" :renote="appearNote.renote" :files="appearNote.files" :poll="appearNote.poll"/>
|
||||
</p>
|
||||
<div v-show="mergedCW == null || showContent">
|
||||
<div v-show="appearNote.cw == null || showContent">
|
||||
<span v-if="appearNote.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
|
||||
<Mfm
|
||||
v-if="appearNote.text"
|
||||
|
|
@ -231,10 +231,7 @@ Detailed view of a note in the Sharkey style. Used when opening a note onto its
|
|||
</MkPagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="_panel" :class="$style.muted" @click.stop="muted = false">
|
||||
<SkMutedNote :muted="muted" :threadMuted="threadMuted" :noteMuted="noteMuted" :note="appearNote"></SkMutedNote>
|
||||
</div>
|
||||
</SkMutedNote>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
|
@ -243,7 +240,6 @@ import * as mfm from 'mfm-js';
|
|||
import * as Misskey from 'misskey-js';
|
||||
import { isLink } from '@@/js/is-link.js';
|
||||
import * as config from '@@/js/config.js';
|
||||
import { computeMergedCw } from '@@/js/compute-merged-cw.js';
|
||||
import type { OpenOnRemoteOptions } from '@/utility/please-login.js';
|
||||
import type { Paging } from '@/components/MkPagination.vue';
|
||||
import type { Keymap } from '@/utility/hotkey.js';
|
||||
|
|
@ -259,7 +255,6 @@ import MkUsersTooltip from '@/components/MkUsersTooltip.vue';
|
|||
import MkUrlPreview from '@/components/MkUrlPreview.vue';
|
||||
import SkInstanceTicker from '@/components/SkInstanceTicker.vue';
|
||||
import { pleaseLogin } from '@/utility/please-login.js';
|
||||
import { checkMutes } from '@/utility/check-word-mute.js';
|
||||
import { userPage } from '@/filters/user.js';
|
||||
import { notePage } from '@/filters/note.js';
|
||||
import number from '@/filters/number.js';
|
||||
|
|
@ -308,7 +303,8 @@ const note = ref(deepClone(props.note));
|
|||
|
||||
const isRenote = Misskey.note.isPureRenote(note.value);
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
const rootComp = useTemplateRef('rootComp');
|
||||
const rootEl = computed(() => rootComp.value?.rootEl ?? null);
|
||||
const noteEl = useTemplateRef('noteEl');
|
||||
const menuButton = useTemplateRef('menuButton');
|
||||
const renoteButton = useTemplateRef('renoteButton');
|
||||
|
|
@ -336,12 +332,8 @@ 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(() => prefer.s.like ? prefer.s.like : null);
|
||||
|
||||
const mergedCW = computed(() => computeMergedCw(appearNote.value));
|
||||
|
||||
const renoteTooltip = computeRenoteTooltip(appearNote);
|
||||
|
||||
const { muted, threadMuted, noteMuted } = checkMutes(appearNote);
|
||||
|
||||
setupNoteViewInterruptors(note, isDeleted);
|
||||
|
||||
watch(() => props.expandAllCws, (expandAllCws) => {
|
||||
|
|
@ -1226,16 +1218,7 @@ onUnmounted(() => {
|
|||
border-radius: var(--MI-radius-sm) !important;
|
||||
}
|
||||
|
||||
.muted {
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.muted:hover {
|
||||
background: var(--MI_THEME-buttonBg);
|
||||
}
|
||||
// Mute CSS moved to SkMutedNote.vue
|
||||
|
||||
.badgeRoles {
|
||||
margin: 0 .5em 0 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue