mirror of
https://github.com/paricafe/misskey.git
synced 2025-02-17 19:27:29 -06:00
backend: restore NoteDeleteService
This commit is contained in:
parent
2e73da70b7
commit
1eec109e33
1 changed files with 8 additions and 25 deletions
|
@ -68,13 +68,6 @@ export class NoteDeleteService {
|
||||||
await this.notesRepository.decrement({ id: note.replyId }, 'repliesCount', 1);
|
await this.notesRepository.decrement({ id: note.replyId }, 'repliesCount', 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) {
|
if (!quiet) {
|
||||||
this.globalEventService.publishNoteStream(note.id, 'deleted', {
|
this.globalEventService.publishNoteStream(note.id, 'deleted', {
|
||||||
deletedAt: deletedAt,
|
deletedAt: deletedAt,
|
||||||
|
@ -113,25 +106,15 @@ export class NoteDeleteService {
|
||||||
this.perUserNotesChart.update(user, note, false);
|
this.perUserNotesChart.update(user, note, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.renoteId && note.text) {
|
if (this.meta.enableStatsForFederatedInstances) {
|
||||||
// Decrement notes count (user)
|
if (this.userEntityService.isRemoteUser(user)) {
|
||||||
this.decNotesCountOfUser(user);
|
this.federatedInstanceService.fetchOrRegister(user.host).then(async i => {
|
||||||
} else if (!note.renoteId) {
|
|
||||||
// Decrement notes count (user)
|
|
||||||
this.decNotesCountOfUser(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.userEntityService.isRemoteUser(user)) {
|
|
||||||
this.federatedInstanceService.fetch(user.host).then(async i => {
|
|
||||||
if (note.renoteId && note.text) {
|
|
||||||
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1);
|
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1);
|
||||||
} else if (!note.renoteId) {
|
if (this.meta.enableChartsForFederatedInstances) {
|
||||||
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1);
|
this.instanceChart.updateNote(i.host, note, false);
|
||||||
}
|
}
|
||||||
if (this.meta.enableChartsForFederatedInstances) {
|
});
|
||||||
this.instanceChart.updateNote(i.host, note, false);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue