fix bulk expand mute
This commit is contained in:
parent
40695c7925
commit
4847257011
11 changed files with 201 additions and 73 deletions
|
|
@ -11,30 +11,61 @@ Displays a note in the detailed view with either Misskey or Sharkey style, based
|
|||
:note="note"
|
||||
:initialTab="initialTab"
|
||||
:expandAllCws="expandAllCws"
|
||||
@expandMute="n => onExpandNote(n)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { computed, defineAsyncComponent, useTemplateRef } from 'vue';
|
||||
import { defineAsyncComponent, useTemplateRef } from 'vue';
|
||||
import type { ComponentExposed } from 'vue-component-type-helpers';
|
||||
import type MkNoteDetailed from '@/components/MkNoteDetailed.vue';
|
||||
import type SkNoteDetailed from '@/components/SkNoteDetailed.vue';
|
||||
import { prefer } from '@/preferences';
|
||||
import { useMuteOverrides } from '@/utility/check-word-mute';
|
||||
import { deepAssign } from '@/utility/merge';
|
||||
|
||||
const XNoteDetailed = defineAsyncComponent(() =>
|
||||
prefer.s.noteDesign === 'misskey'
|
||||
? import('@/components/MkNoteDetailed.vue')
|
||||
: import('@/components/SkNoteDetailed.vue'),
|
||||
);
|
||||
? import('@/components/MkNoteDetailed.vue')
|
||||
: import('@/components/SkNoteDetailed.vue'));
|
||||
|
||||
const rootEl = useTemplateRef<ComponentExposed<typeof MkNoteDetailed | typeof SkNoteDetailed>>('rootEl');
|
||||
const muteOverrides = useMuteOverrides();
|
||||
|
||||
defineExpose({ rootEl });
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
initialTab?: string;
|
||||
expandAllCws?: boolean;
|
||||
}>();
|
||||
|
||||
// TODO map to expand all CWs?
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'expandMute', note: Misskey.entities.Note): void;
|
||||
}>();
|
||||
|
||||
function onExpandNote(note: Misskey.entities.Note) {
|
||||
// Since this is a Detailed note, note.props must point to the top of a thread.
|
||||
// Go ahead and expand matching user/instance/thread mutes downstream, since the user is very likely to want them.
|
||||
if (note.id === props.note.id) {
|
||||
deepAssign(muteOverrides, {
|
||||
user: {
|
||||
[note.user.id]: {
|
||||
userMandatoryCW: null,
|
||||
instanceMandatoryCW: null,
|
||||
},
|
||||
},
|
||||
thread: {
|
||||
[note.threadId]: {
|
||||
threadMuted: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
emit('expandMute', note);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue