fix: don't decrement past 0

This commit is contained in:
Mar0xy 2023-10-15 18:16:41 +02:00
parent 48c7eeb57e
commit 97df169ebe
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ export class NoteDeleteService {
await this.notesRepository.decrement({ id: note.replyId }, 'repliesCount', 1);
}
if (note.renoteId && note.renote?.userId !== user.id && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) {
if (note.renoteId && note.renote?.renoteCount !== 0 && note.renote?.userId !== user.id && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) {
await this.notesRepository.decrement({ id: note.renoteId }, 'renoteCount', 1);
}