expand matching user/instance in DynamicNote
This commit is contained in:
parent
d62be884b3
commit
ffcb6de3c0
1 changed files with 25 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ Displays a note with either Misskey or Sharkey style, based on user preference.
|
|||
:withHardMute="withHardMute"
|
||||
@reaction="emoji => emit('reaction', emoji)"
|
||||
@removeReaction="emoji => emit('removeReaction', emoji)"
|
||||
@expandMute="n => emit('expandMute', n)"
|
||||
@expandMute="n => onExpandNote(n)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
@ -25,6 +25,8 @@ import type { ComponentExposed } from 'vue-component-type-helpers';
|
|||
import type MkNote from '@/components/MkNote.vue';
|
||||
import type SkNote from '@/components/SkNote.vue';
|
||||
import { prefer } from '@/preferences';
|
||||
import { deepAssign } from '@/utility/merge';
|
||||
import { useMuteOverrides } from '@/utility/check-word-mute';
|
||||
|
||||
const XNote = defineAsyncComponent(() =>
|
||||
prefer.s.noteDesign === 'misskey'
|
||||
|
|
@ -32,10 +34,11 @@ const XNote = defineAsyncComponent(() =>
|
|||
: import('@/components/SkNote.vue'));
|
||||
|
||||
const rootEl = useTemplateRef<ComponentExposed<typeof MkNote | typeof SkNote>>('rootEl');
|
||||
const muteOverrides = useMuteOverrides();
|
||||
|
||||
defineExpose({ rootEl });
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
pinned?: boolean;
|
||||
mock?: boolean;
|
||||
|
|
@ -47,4 +50,24 @@ const emit = defineEmits<{
|
|||
(ev: 'removeReaction', emoji: string): void;
|
||||
(ev: 'expandMute', note: Misskey.entities.Note): void;
|
||||
}>();
|
||||
|
||||
function onExpandNote(note: Misskey.entities.Note) {
|
||||
// Expand the user/instance CW for matching subthread (and the inline reply/renote view)
|
||||
if (note.id === props.note.id) {
|
||||
deepAssign(muteOverrides, {
|
||||
user: {
|
||||
[note.user.id]: {
|
||||
userMandatoryCW: null,
|
||||
},
|
||||
},
|
||||
instance: {
|
||||
[note.user.host ?? '']: {
|
||||
instanceMandatoryCW: null,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
emit('expandMute', note);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue