summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteDeleteService.ts
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-10-15 19:43:57 +0200
committerMar0xy <marie@kaifa.ch>2023-10-15 19:43:57 +0200
commit85f3534b2c94722ec7f3c0748c4379b49224f99c (patch)
treeef7df661f930d40a9f8817c052179d5beef8ec7d /packages/backend/src/core/NoteDeleteService.ts
parentchore: add newline between } and @media (diff)
downloadsharkey-85f3534b2c94722ec7f3c0748c4379b49224f99c.tar.gz
sharkey-85f3534b2c94722ec7f3c0748c4379b49224f99c.tar.bz2
sharkey-85f3534b2c94722ec7f3c0748c4379b49224f99c.zip
fix: decrement of renotecount
Diffstat (limited to 'packages/backend/src/core/NoteDeleteService.ts')
-rw-r--r--packages/backend/src/core/NoteDeleteService.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/backend/src/core/NoteDeleteService.ts b/packages/backend/src/core/NoteDeleteService.ts
index 33e39ec8b5..63e49ce0d3 100644
--- a/packages/backend/src/core/NoteDeleteService.ts
+++ b/packages/backend/src/core/NoteDeleteService.ts
@@ -68,8 +68,11 @@ export class NoteDeleteService {
await this.notesRepository.decrement({ id: note.replyId }, 'repliesCount', 1);
}
- 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);
+ if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) {
+ await this.notesRepository.findOneBy({ id: note.renoteId }).then(async (renote) => {
+ if (!renote) return;
+ if (renote.userId !== user.id) await this.notesRepository.decrement({ id: renote.id }, 'renoteCount', 1);
+ });
}
if (!quiet) {