From 1bc145678b640be5025963df06f4df02e897d7c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 20 Jan 2022 23:39:51 +0900 Subject: [PATCH] fix --- packages/backend/src/misc/populate-emojis.ts | 2 +- .../backend/src/services/note/reaction/create.ts | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index d808ab25f..9e788d8be 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -116,7 +116,7 @@ export async function prefetchEmojis(emojis: { name: string; host: string | null } const _emojis = emojisQuery.length > 0 ? await Emojis.find({ where: emojisQuery, - select: ['name', 'host', 'url'], + select: ['name', 'host', 'originalUrl', 'publicUrl'], }) : []; for (const emoji of _emojis) { cache.set(`${emoji.name} ${emoji.host}`, emoji); diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index 2e68420c1..795bb691c 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -81,19 +81,15 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, name: decodedReaction.name, host: decodedReaction.host, }, - select: ['name', 'host', 'url'], + select: ['name', 'host', 'originalUrl', 'publicUrl'], }); - if (emoji) { - emoji = { - name: emoji.host ? `${emoji.name}@${emoji.host}` : `${emoji.name}@.`, - url: emoji.publicUrl, - } as any; - } - publishNoteStream(note.id, 'reacted', { reaction: decodedReaction.reaction, - emoji: emoji, + emoji: emoji != null ? { + name: emoji.host ? `${emoji.name}@${emoji.host}` : `${emoji.name}@.`, + url: emoji.publicUrl ?? emoji.originalUrl, + } : null, userId: user.id, });