docbrown/app/workers/comments/create_first_reaction_worker.rb
rhymes 5a2cae4fbb
Rubocop: enable and fix new Rails cops (#9537)
* Enable new Rails/* cops and use autocorrect on them

* Fixed Rails/PluckInWhere leftovers

* Fix Rails/DefaultScope

* Enable and fix Rails/PluckId

* Fix manual mistake with forcing autocorrection on Rails/PluckId

* Apply PR feedback to remove Rails/PluckId inline disables

* Apply PR feedback to get rid of Rails/PluckInWhere inline
2020-07-29 11:14:19 +02:00

18 lines
393 B
Ruby

module Comments
class CreateFirstReactionWorker
include Sidekiq::Worker
sidekiq_options queue: :high_priority, retry: 10
def perform(comment_id, user_id)
return unless Comment.exists?(id: comment_id)
Reaction.create(
user_id: user_id,
reactable_id: comment_id,
reactable_type: "Comment",
category: "like",
)
end
end
end