Add emoji reaction deletion api
This commit is contained in:
parent
5f7da7bff1
commit
15bc0df759
14 changed files with 142 additions and 45 deletions
19
app/workers/un_emoji_react_worker.rb
Normal file
19
app/workers/un_emoji_react_worker.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UnEmojiReactWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(account_id, status_id, emoji = nil)
|
||||
emoji_reaction = nil
|
||||
|
||||
if emoji
|
||||
shortcode, domain = emoji.split('@')
|
||||
emoji_reaction = EmojiReaction.where(account_id: account_id).where(status_id: status_id).where(name: shortcode)
|
||||
.find { |reaction| domain == '' ? reaction.custom_emoji.nil? : reaction.custom_emoji&.domain == domain }
|
||||
end
|
||||
|
||||
UnEmojiReactService.new.call(Account.find(account_id), Status.find(status_id), emoji_reaction)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue