From 3d92ef193e3922441f8a9e211dec0d5a7a68252e Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:44:14 +0900 Subject: [PATCH] fix rbt --- packages/backend/src/core/ReactionService.ts | 5 ----- packages/backend/src/core/entities/NoteEntityService.ts | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts index 5993c42a1f..db8fe1a838 100644 --- a/packages/backend/src/core/ReactionService.ts +++ b/packages/backend/src/core/ReactionService.ts @@ -197,11 +197,6 @@ export class ReactionService { // Increment reactions count if (meta.enableReactionsBuffering) { await this.reactionsBufferingService.create(note.id, user.id, reaction, note.reactionAndUserPairCache); - - // for debugging - if (reaction === ':angry_ai:') { - this.reactionsBufferingService.bake(); - } } else { const sql = `jsonb_set("reactions", '{${reaction}}', (COALESCE("reactions"->>'${reaction}', '0')::int + 1)::text::jsonb)`; await this.notesRepository.createQueryBuilder().update() diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 7506d804c3..0d0b80765a 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -324,7 +324,13 @@ export class NoteEntityService implements OnModuleInit { const note = typeof src === 'object' ? src : await this.noteLoader.load(src); const host = note.userHost; - const bufferdReactions = opts._hint_?.bufferdReactions != null ? (opts._hint_.bufferdReactions.get(note.id) ?? { deltas: {}, pairs: [] }) : await this.reactionsBufferingService.get(note.id); + const meta = await this.metaService.fetch(); + + const bufferdReactions = opts._hint_?.bufferdReactions != null + ? (opts._hint_.bufferdReactions.get(note.id) ?? { deltas: {}, pairs: [] }) + : meta.enableReactionsBuffering + ? await this.reactionsBufferingService.get(note.id) + : { deltas: {}, pairs: [] }; const reactions = mergeReactions(note.reactions, bufferdReactions.deltas ?? {}); for (const [name, count] of Object.entries(reactions)) { if (count <= 0) {