rename deltaRepliesCount and deltaRenoteCount to match the other deltas
This commit is contained in:
parent
c52f852db1
commit
ad063c8637
3 changed files with 12 additions and 12 deletions
|
|
@ -29,8 +29,8 @@ export type UpdateUserJob = {
|
|||
};
|
||||
|
||||
export type UpdateNoteJob = {
|
||||
deltaRepliesCount?: number;
|
||||
deltaRenoteCount?: number;
|
||||
repliesCountDelta?: number;
|
||||
renoteCountDelta?: number;
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -102,12 +102,12 @@ export class CollapsedQueueService implements OnApplicationShutdown {
|
|||
'updateNote',
|
||||
oneMinuteInterval,
|
||||
(oldJob, newJob) => ({
|
||||
deltaRepliesCount: (oldJob.deltaRepliesCount ?? 0) + (newJob.deltaRepliesCount ?? 0),
|
||||
deltaRenoteCount: (oldJob.deltaRenoteCount ?? 0) + (newJob.deltaRenoteCount ?? 0),
|
||||
repliesCountDelta: (oldJob.repliesCountDelta ?? 0) + (newJob.repliesCountDelta ?? 0),
|
||||
renoteCountDelta: (oldJob.renoteCountDelta ?? 0) + (newJob.renoteCountDelta ?? 0),
|
||||
}),
|
||||
(id, job) => this.notesRepository.update({ id }, {
|
||||
repliesCount: job.deltaRepliesCount ? () => `"repliesCount" + ${job.deltaRepliesCount}` : undefined,
|
||||
renoteCount: job.deltaRenoteCount ? () => `"renoteCount" + ${job.deltaRenoteCount}` : undefined,
|
||||
repliesCount: job.repliesCountDelta ? () => `"repliesCount" + ${job.repliesCountDelta}` : undefined,
|
||||
renoteCount: job.renoteCountDelta ? () => `"renoteCount" + ${job.renoteCountDelta}` : undefined,
|
||||
}),
|
||||
{
|
||||
onError: this.onQueueError,
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
}, user);
|
||||
|
||||
if (data.reply) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(data.reply.id, { deltaRepliesCount: 1 });
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(data.reply.id, { repliesCountDelta: 1 });
|
||||
}
|
||||
|
||||
if (data.reply == null) {
|
||||
|
|
@ -648,7 +648,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
|
||||
// TODO move these checks into incRenoteCount
|
||||
if (this.isPureRenote(data) && data.renote.userId !== user.id && !user.isBot) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(data.renote.id, { deltaRenoteCount: 1 });
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(data.renote.id, { renoteCountDelta: 1 });
|
||||
await this.incRenoteCount(data.renote, user)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,16 +78,16 @@ export class NoteDeleteService {
|
|||
const cascadingNotes = await this.findCascadingNotes(note);
|
||||
|
||||
if (note.replyId) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(note.replyId, { deltaRepliesCount: -1 });
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(note.replyId, { repliesCountDelta: -1 });
|
||||
} else if (isPureRenote(note)) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(note.renoteId, { deltaRenoteCount: -1 });
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(note.renoteId, { renoteCountDelta: -1 });
|
||||
}
|
||||
|
||||
for (const cascade of cascadingNotes) {
|
||||
if (cascade.replyId) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(cascade.replyId, { deltaRepliesCount: -1 });
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(cascade.replyId, { repliesCountDelta: -1 });
|
||||
} else if (isPureRenote(cascade)) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(cascade.renoteId, { deltaRenoteCount: -1 });
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(cascade.renoteId, { renoteCountDelta: -1 });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue