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 f9730eba77
commit b326dcab78
No known key found for this signature in database
GPG key ID: 80A419A7A613DFA4

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