update latest_note for edits

This commit is contained in:
Hazelnoot 2024-10-13 18:17:09 -04:00
parent 93cf2f9045
commit 5dc700938d

View file

@ -52,6 +52,7 @@ import { isReply } from '@/misc/is-reply.js';
import { trackPromise } from '@/misc/promise-tracker.js'; import { trackPromise } from '@/misc/promise-tracker.js';
import { isUserRelated } from '@/misc/is-user-related.js'; import { isUserRelated } from '@/misc/is-user-related.js';
import { IdentifiableError } from '@/misc/identifiable-error.js'; import { IdentifiableError } from '@/misc/identifiable-error.js';
import { LatestNoteService } from '@/core/LatestNoteService.js';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention' | 'edited'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention' | 'edited';
@ -214,6 +215,7 @@ export class NoteEditService implements OnApplicationShutdown {
private utilityService: UtilityService, private utilityService: UtilityService,
private userBlockingService: UserBlockingService, private userBlockingService: UserBlockingService,
private cacheService: CacheService, private cacheService: CacheService,
private latestNoteService: LatestNoteService,
) { } ) { }
@bindThis @bindThis
@ -558,7 +560,7 @@ export class NoteEditService implements OnApplicationShutdown {
} }
setImmediate('post edited', { signal: this.#shutdownController.signal }).then( 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 */ }, () => { /* aborted, ignore this */ },
); );
@ -569,7 +571,7 @@ export class NoteEditService implements OnApplicationShutdown {
} }
@bindThis @bindThis
private async postNoteEdited(note: MiNote, user: { private async postNoteEdited(note: MiNote, oldNote: MiNote, user: {
id: MiUser['id']; id: MiUser['id'];
username: MiUser['username']; username: MiUser['username'];
host: MiUser['host']; 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 // Register to search database
if (!user.noindex) this.index(note); if (!user.noindex) this.index(note);
} }