From 5dc700938d37752dc1a74d9b3f89a172996c44a2 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sun, 13 Oct 2024 18:17:09 -0400 Subject: [PATCH] update latest_note for edits --- packages/backend/src/core/NoteEditService.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index aecd37aeb9..58114a0e0c 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -52,6 +52,7 @@ import { isReply } from '@/misc/is-reply.js'; import { trackPromise } from '@/misc/promise-tracker.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; +import { LatestNoteService } from '@/core/LatestNoteService.js'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention' | 'edited'; @@ -214,6 +215,7 @@ export class NoteEditService implements OnApplicationShutdown { private utilityService: UtilityService, private userBlockingService: UserBlockingService, private cacheService: CacheService, + private latestNoteService: LatestNoteService, ) { } @bindThis @@ -558,7 +560,7 @@ export class NoteEditService implements OnApplicationShutdown { } setImmediate('post edited', { signal: this.#shutdownController.signal }).then( - () => this.postNoteEdited(note, user, data, silent, tags!, mentionedUsers!), + () => this.postNoteEdited(note, oldnote, user, data, silent, tags!, mentionedUsers!), () => { /* aborted, ignore this */ }, ); @@ -569,7 +571,7 @@ export class NoteEditService implements OnApplicationShutdown { } @bindThis - private async postNoteEdited(note: MiNote, user: { + private async postNoteEdited(note: MiNote, oldNote: MiNote, user: { id: MiUser['id']; username: MiUser['username']; host: MiUser['host']; @@ -766,6 +768,9 @@ export class NoteEditService implements OnApplicationShutdown { }); } + // Update the Latest Note index / following feed + this.latestNoteService.handleUpdatedNoteBG(oldNote, note); + // Register to search database if (!user.noindex) this.index(note); }