From e1ab3206a682a30e20a5c5389025e5c4430f788f Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 21 Jan 2022 00:37:06 +0900 Subject: [PATCH] emoji fallback --- packages/backend/src/misc/populate-emojis.ts | 2 +- packages/backend/src/remote/activitypub/renderer/emoji.ts | 2 +- packages/backend/src/services/note/reaction/create.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index 9e788d8be..76f2e37cd 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -62,7 +62,7 @@ export async function populateEmoji(emojiName: string, noteUserHost: string | nu if (emoji == null) return null; const isLocal = emoji.host == null; - const url = isLocal ? emoji.publicUrl : `${config.url}/proxy/image.png?${query({ url: emoji.publicUrl })}`; + const url = isLocal ? emoji.publicUrl || emoji.originalUrl : `${config.url}/proxy/image.png?${query({ url: emoji.publicUrl || emoji.originalUrl })}`; return { name: emojiName, diff --git a/packages/backend/src/remote/activitypub/renderer/emoji.ts b/packages/backend/src/remote/activitypub/renderer/emoji.ts index 0c0bc382f..4ad4c8355 100644 --- a/packages/backend/src/remote/activitypub/renderer/emoji.ts +++ b/packages/backend/src/remote/activitypub/renderer/emoji.ts @@ -9,6 +9,6 @@ export default (emoji: Emoji) => ({ icon: { type: 'Image', mediaType: emoji.type || 'image/png', - url: emoji.publicUrl, + url: emoji.publicUrl || emoji.originalUrl, }, }); diff --git a/packages/backend/src/services/note/reaction/create.ts b/packages/backend/src/services/note/reaction/create.ts index 795bb691c..603ac3bf5 100644 --- a/packages/backend/src/services/note/reaction/create.ts +++ b/packages/backend/src/services/note/reaction/create.ts @@ -88,7 +88,7 @@ export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction: decodedReaction.reaction, emoji: emoji != null ? { name: emoji.host ? `${emoji.name}@${emoji.host}` : `${emoji.name}@.`, - url: emoji.publicUrl ?? emoji.originalUrl, + url: emoji.publicUrl || emoji.originalUrl, } : null, userId: user.id, });