fix: decrement happening on normal renotes

This commit is contained in:
Mar0xy 2023-10-21 12:48:39 +02:00
parent 1608e32ed7
commit 9eb094aeb9
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -115,19 +115,19 @@ export class NoteDeleteService {
this.perUserNotesChart.update(user, note, false); this.perUserNotesChart.update(user, note, false);
} }
if (note.renote && note.text) { if (note.renoteId && note.text) {
// Decrement notes count (user) // Decrement notes count (user)
this.decNotesCountOfUser(user); this.decNotesCountOfUser(user);
} else if (!note.renote) { } else if (!note.renoteId) {
// Decrement notes count (user) // Decrement notes count (user)
this.decNotesCountOfUser(user); this.decNotesCountOfUser(user);
} }
if (this.userEntityService.isRemoteUser(user)) { if (this.userEntityService.isRemoteUser(user)) {
this.federatedInstanceService.fetch(user.host).then(async i => { this.federatedInstanceService.fetch(user.host).then(async i => {
if (note.renote && note.text) { if (note.renoteId && note.text) {
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1); this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1);
} else if (!note.renote) { } else if (!note.renoteId) {
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1); this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1);
} }
if ((await this.metaService.fetch()).enableChartsForFederatedInstances) { if ((await this.metaService.fetch()).enableChartsForFederatedInstances) {