make renote count increment and decrement the same way

This commit is contained in:
Hazelnoot 2025-06-24 11:47:01 -04:00
parent 2bca84048d
commit d06b2353b5

View file

@ -644,7 +644,7 @@ export class NoteCreateService implements OnApplicationShutdown {
});
}
if (this.isRenote(data) && !this.isQuote(data) && data.renote.userId !== user.id && !user.isBot) {
if (this.isPureRenote(data) && data.renote.userId !== user.id && !user.isBot) {
await this.incRenoteCount(data.renote, user);
}
@ -822,12 +822,7 @@ export class NoteCreateService implements OnApplicationShutdown {
@bindThis
private async incRenoteCount(renote: MiNote, user: MiUser) {
await this.notesRepository.createQueryBuilder().update()
.set({
renoteCount: () => '"renoteCount" + 1',
})
.where('id = :id', { id: renote.id })
.execute();
await this.notesRepository.increment({ id: renote.id }, 'renoteCount', 1);
// 30%の確率、3日以内に投稿されたートの場合ハイライト用ランキング更新
if (user.isExplorable && Math.random() < 0.3 && (this.timeService.now - this.idService.parse(renote.id).date.getTime()) < 1000 * 60 * 60 * 24 * 3) {