Skip to content

Commit

Permalink
fix rbt
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Sep 21, 2024
1 parent e9085e4 commit 3d92ef1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 0 additions & 5 deletions packages/backend/src/core/ReactionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 7 additions & 1 deletion packages/backend/src/core/entities/NoteEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

This comment has been minimized.

Copy link
@kakkokari-gtyih

kakkokari-gtyih Sep 21, 2024

Contributor

bufferd じゃなくて bufferedかも

? (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) {
Expand Down

0 comments on commit 3d92ef1

Please sign in to comment.