[backend/services] Increment Note.RepliesCount on note create

This commit is contained in:
Laura Hausmann 2024-02-14 01:17:04 +01:00
parent 8f8e3f9d1a
commit 9591255220
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -81,6 +81,7 @@ public class NoteService(
}; };
user.NotesCount++; user.NotesCount++;
if (reply != null) reply.RepliesCount++;
await db.AddAsync(note); await db.AddAsync(note);
await db.SaveChangesAsync(); await db.SaveChangesAsync();
await notificationSvc.GenerateMentionNotifications(note, mentionedLocalUserIds); await notificationSvc.GenerateMentionNotifications(note, mentionedLocalUserIds);
@ -208,6 +209,7 @@ public class NoteService(
} }
user.NotesCount++; user.NotesCount++;
if (dbNote.Reply != null) dbNote.Reply.RepliesCount++;
await db.Notes.AddAsync(dbNote); await db.Notes.AddAsync(dbNote);
await db.SaveChangesAsync(); await db.SaveChangesAsync();
await notificationSvc.GenerateMentionNotifications(dbNote, mentionedLocalUserIds); await notificationSvc.GenerateMentionNotifications(dbNote, mentionedLocalUserIds);