From 03845b0be2a63548130a790e818514e29a07ca70 Mon Sep 17 00:00:00 2001 From: Plastikmensch Date: Sun, 14 May 2023 23:56:10 +0200 Subject: [PATCH] Only process single custom emoji Processing all custom emojis is neither wise nor necessary as both `Like` and `EmojiReact` only expect a single custom emoji Signed-off-by: Plastikmensch --- app/lib/activitypub/activity.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb index 00d724a28..0fc6d3ef7 100644 --- a/app/lib/activitypub/activity.rb +++ b/app/lib/activitypub/activity.rb @@ -179,13 +179,14 @@ class ActivityPub::Activity nil end - # Ensure all emojis declared in the activity's tags are + # Ensure emoji declared in the activity's tags are # present in the database and downloaded to the local cache. # Required by EmojiReact and Like for emoji reactions. def process_emoji_tags(tags) - as_array(tags).each do |tag| - process_single_emoji tag if tag['type'] == 'Emoji' - end + emoji_tag = as_array(tags).find { |tag| tag['type'] == 'Emoji' } + return if emoji_tag.nil? + + process_single_emoji emoji_tag end def process_single_emoji(tag)