From e90ab798a1c267a976c158115bef70c60d2b5395 Mon Sep 17 00:00:00 2001 From: Plastikmensch Date: Mon, 15 May 2023 00:03:12 +0200 Subject: [PATCH] Don't allow reactions with disabled custom emojis Also doesn't set custom_emoji to a local variant of name when not given. Signed-off-by: Plastikmensch --- app/models/status_reaction.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/status_reaction.rb b/app/models/status_reaction.rb index a54d03a30..bc6eda2a1 100644 --- a/app/models/status_reaction.rb +++ b/app/models/status_reaction.rb @@ -26,7 +26,8 @@ class StatusReaction < ApplicationRecord private + # Sets custom_emoji to nil when disabled def set_custom_emoji - self.custom_emoji = CustomEmoji.find_by(shortcode: name, domain: account.domain) if name.blank? + self.custom_emoji = CustomEmoji.find_by(disabled: false, shortcode: name, domain: custom_emoji.domain) if name.present? && custom_emoji.present? end end