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>();
unuse.value = noteManager.useNote(props.note.id, true).unuse;
unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
onMounted(() => {
executeInterruptor();
@ -488,19 +489,20 @@ onUnmounted(() => {
});
onActivated(() => {
if (!unuse.value) {
unuse.value = noteManager.useNote(props.note.id, true).unuse;
if (!unuse.value && appearNote.value) {
unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
}
});
onDeactivated(() => {
const _unuse = unuse.value;
unuse.value = undefined;
//
setTimeout(() => {
if (unuse.value) {
unuse.value();
unuse.value = undefined;
}
}, 1000);
if (_unuse) {
setTimeout(() => {
_unuse();
}, 1000);
}
});
</script>

View File

@ -407,7 +407,7 @@ function 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 () => {
await fetching;

View File

@ -47,6 +47,14 @@ type CachedNoteSource = Ref<OmittedNote | null>;
type CachedNote = ComputedRef<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) {
const { interruptedNote: note, interruptorUnwatch, executeInterruptor } = this.getInterrupted(id);
//const note = this.get(id);
const isRenote = computed(() => (
note.value != null &&
note.value.renote != null &&
note.value.text == null &&
note.value.fileIds?.length === 0 &&
note.value.poll == null
));
const isRenote = computed(() => isRenote(note.value));
const isMyRenote = computed(() => $i && ($i.id === note.value?.userId));
const appearNote = computed(() => (isRenote.value ? note.value?.renote : note.value) ?? null);