mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	fix rbt
This commit is contained in:
		
							parent
							
								
									e9085e455f
								
							
						
					
					
						commit
						3d92ef193e
					
				
					 2 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -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()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue