From 78bdb3b29f3c06c64b9175923c00bbf9e0a409fa Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 14 Mar 2023 16:29:27 -0700 Subject: [PATCH] reaction lib from dev --- packages/backend/src/misc/reaction-lib.ts | 33 ++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index 7d78904bb..e25b2d661 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -5,17 +5,17 @@ import { toPunyNullable } from "./convert-host.js"; import { IsNull } from "typeorm"; const legacies = new Map([ - ['like', '👍'], - ['love', '❤️'], - ['laugh', '😆'], - ['hmm', '🤔'], - ['surprise', '😮'], - ['congrats', '🎉'], - ['angry', '💢'], - ['confused', '😥'], - ['rip', '😇'], - ['pudding', '🍮'], - ['star', '⭐'], + ["like", "👍"], + ["love", "❤️"], + ["laugh", "😆"], + ["hmm", "🤔"], + ["surprise", "😮"], + ["congrats", "🎉"], + ["angry", "💢"], + ["confused", "😥"], + ["rip", "😇"], + ["pudding", "🍮"], + ["star", "⭐"], ]); export async function getFallbackReaction() { @@ -42,7 +42,10 @@ export function convertLegacyReactions(reactions: Record) { if (emoji) { _reactions.set(emoji, (_reactions.get(emoji) || 0) + reactions[reaction]); } else { - _reactions.set(reaction, (_reactions.get(reaction) || 0) + reactions[reaction]); + _reactions.set( + reaction, + (_reactions.get(reaction) || 0) + reactions[reaction], + ); } } @@ -127,7 +130,7 @@ export function decodeReaction(str: string): DecodedReaction { } export function convertLegacyReaction(reaction: string): string { - const decoded = decodeReaction(reaction).reaction; - if (legacies.has(decoded)) return legacies.get(decoded)!; - return decoded; + const decoded = decodeReaction(reaction).reaction; + if (legacies.has(decoded)) return legacies.get(decoded)!; + return decoded; }