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 <plastikmensch@users.noreply.github.com>
This commit is contained in:
Plastikmensch 2023-05-15 00:03:12 +02:00 committed by Jeremy Kescher
parent 63facd7c8e
commit e90ab798a1
No known key found for this signature in database
GPG Key ID: 80A419A7A613DFA4
1 changed files with 2 additions and 1 deletions

View File

@ -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