This commit is contained in:
tamaina 2023-07-30 11:08:05 +00:00
parent f6c2fae089
commit be2e596027
3 changed files with 21 additions and 18 deletions

View File

@ -473,7 +473,8 @@ function showReactions(): void {
} }
const unuse = ref<() => void>(); const unuse = ref<() => void>();
unuse.value = noteManager.useNote(props.note.id, true).unuse;
unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
onMounted(() => { onMounted(() => {
executeInterruptor(); executeInterruptor();
@ -488,19 +489,20 @@ onUnmounted(() => {
}); });
onActivated(() => { onActivated(() => {
if (!unuse.value) { if (!unuse.value && appearNote.value) {
unuse.value = noteManager.useNote(props.note.id, true).unuse; unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
} }
}); });
onDeactivated(() => { onDeactivated(() => {
const _unuse = unuse.value;
unuse.value = undefined;
// //
setTimeout(() => { if (_unuse) {
if (unuse.value) { setTimeout(() => {
unuse.value(); _unuse();
unuse.value = undefined; }, 1000);
} }
}, 1000);
}); });
</script> </script>

View File

@ -407,7 +407,7 @@ function blur() {
el.value?.blur(); el.value?.blur();
} }
const { note: fetching, unuse } = noteManager.useNote(props.note.id, true); const { note: fetching, unuse } = noteManager.useNote(appearNote.value?.id ?? props.note.id, true);
onMounted(async () => { onMounted(async () => {
await fetching; await fetching;

View File

@ -47,6 +47,14 @@ type CachedNoteSource = Ref<OmittedNote | null>;
type CachedNote = ComputedRef<Note | null>; type CachedNote = ComputedRef<Note | null>;
type InterruptedCachedNote = Ref<Note | null>; type InterruptedCachedNote = Ref<Note | null>;
export function isRenote(note: Note | OmittedNote): boolean {
return note != null &&
note.renoteId != null &&
note.text == null &&
note.fileIds?.length === 0 &&
note.poll == null;
}
/** /**
* *
* 使: * 使:
@ -197,14 +205,7 @@ export class NoteManager {
*/ */
public getNoteViewBase(id: string) { public getNoteViewBase(id: string) {
const { interruptedNote: note, interruptorUnwatch, executeInterruptor } = this.getInterrupted(id); const { interruptedNote: note, interruptorUnwatch, executeInterruptor } = this.getInterrupted(id);
//const note = this.get(id); const isRenote = computed(() => isRenote(note.value));
const isRenote = computed(() => (
note.value != null &&
note.value.renote != null &&
note.value.text == null &&
note.value.fileIds?.length === 0 &&
note.value.poll == null
));
const isMyRenote = computed(() => $i && ($i.id === note.value?.userId)); const isMyRenote = computed(() => $i && ($i.id === note.value?.userId));
const appearNote = computed(() => (isRenote.value ? note.value?.renote : note.value) ?? null); const appearNote = computed(() => (isRenote.value ? note.value?.renote : note.value) ?? null);