bulk-expand mandatory CWs on the following feed's user view

This commit is contained in:
Hazelnoot 2025-06-29 19:30:26 -04:00
parent dfb3106dea
commit 57b9988c81
2 changed files with 22 additions and 4 deletions

View file

@ -9,7 +9,7 @@ Displays a user's recent notes for the "Following" feed.
<MkPullToRefresh :refresher="() => reload()">
<div v-if="user" :class="$style.userInfo">
<MkUserInfo :class="$style.userInfo" class="user" :user="user"/>
<MkNotes :noGap="true" :pagination="pagination"/>
<MkNotes :noGap="true" :pagination="pagination" @expandMute="n => onExpandMute(n)"/>
</div>
<div v-else-if="loadError" :class="$style.panel">{{ loadError }}</div>
<MkLoading v-else-if="userId"/>
@ -26,6 +26,8 @@ import MkNotes from '@/components/MkNotes.vue';
import MkUserInfo from '@/components/MkUserInfo.vue';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import { misskeyApi } from '@/utility/misskey-api.js';
import { useMuteOverrides } from '@/utility/check-word-mute';
import { deepAssign } from '@/utility/merge';
const props = defineProps<{
userId: string;
@ -54,6 +56,22 @@ const pagination: Paging<'users/notes'> = {
})),
};
const muteOverrides = useMuteOverrides();
function onExpandMute(note: Misskey.entities.Note) {
if (note.user.id === props.userId) {
// This kills the mandatoryCW for this user below this point
deepAssign(muteOverrides, {
user: {
[props.userId]: {
userMandatoryCW: null,
instanceMandatoryCW: null,
},
},
});
}
}
defineExpose({
reload,
user,

View file

@ -176,10 +176,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkResult type="empty" :text="i18n.ts.noNotes"/>
</div>
<div v-else class="_panel">
<DynamicNote v-for="note of user.pinnedNotes" :key="note.id" class="note" :class="$style.pinnedNote" :note="note" :pinned="true" @expandMute="n => onExpandCW(n)"/>
<DynamicNote v-for="note of user.pinnedNotes" :key="note.id" class="note" :class="$style.pinnedNote" :note="note" :pinned="true" @expandMute="n => onExpandMute(n)"/>
</div>
</div>
<MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination" @expandMute="n => onExpandCW(n)"/>
<MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination" @expandMute="n => onExpandMute(n)"/>
</MkLazy>
</MkStickyContainer>
</div>
@ -259,7 +259,7 @@ const emit = defineEmits<{
const muteOverrides = useMuteOverrides();
function onExpandCW(note: Misskey.entities.Note) {
function onExpandMute(note: Misskey.entities.Note) {
if (note.user.id === props.user.id) {
// This kills the mandatoryCW for this user below this point
deepAssign(muteOverrides, {