increment/decrement note counts through CollapsedQueueService
This commit is contained in:
parent
28dff9aff9
commit
81fd01d5fa
3 changed files with 10 additions and 27 deletions
|
|
@ -605,7 +605,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
|
||||
if (!this.isRenote(note) || this.isQuote(note)) {
|
||||
// Increment notes count (user)
|
||||
await this.incNotesCountOfUser(user);
|
||||
this.collapsedQueueService.updateUserQueue.enqueue(user.id, { additionalNotes: 1 });
|
||||
}
|
||||
|
||||
this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: new Date() });
|
||||
|
|
@ -890,17 +890,6 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
await this.searchService.indexNote(note);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async incNotesCountOfUser(user: { id: MiUser['id']; }) {
|
||||
await this.usersRepository.createQueryBuilder().update()
|
||||
.set({
|
||||
updatedAt: this.timeService.date,
|
||||
notesCount: () => '"notesCount" + 1',
|
||||
})
|
||||
.where('id = :id', { id: user.id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async extractMentionedUsers(user: { host: MiUser['host']; }, tokens: mfm.MfmNode[]): Promise<MiUser[]> {
|
||||
if (tokens == null) return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue