Rescue uncaught RecordInvalid errors
These occur when an account tries to react with disabled custom emojis. In both `EmojiReact` and `Like? activities, the activity is discarded. Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
This commit is contained in:
parent
051bb17de8
commit
239170830e
2 changed files with 5 additions and 0 deletions
|
@ -22,5 +22,7 @@ class ActivityPub::Activity::EmojiReact < ActivityPub::Activity
|
||||||
reaction = original_status.status_reactions.create!(account: @account, name: name, custom_emoji: custom_emoji)
|
reaction = original_status.status_reactions.create!(account: @account, name: name, custom_emoji: custom_emoji)
|
||||||
|
|
||||||
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
||||||
|
rescue ActiveRecord::RecordInvalid
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,5 +34,8 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
|
||||||
reaction = original_status.status_reactions.create!(account: @account, name: name, custom_emoji: custom_emoji)
|
reaction = original_status.status_reactions.create!(account: @account, name: name, custom_emoji: custom_emoji)
|
||||||
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
LocalNotificationWorker.perform_async(original_status.account_id, reaction.id, 'StatusReaction', 'reaction')
|
||||||
true
|
true
|
||||||
|
# account tried to react with disabled custom emoji. Returning true to discard activity.
|
||||||
|
rescue ActiveRecord::RecordInvalid
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue