* Move authors followers out of Notifications::NotifiableAction::Send and into Article model * Rename authors_followers to followers * Update followers method in service, oops * Update app/services/notifications/notifiable_action/send.rb Co-authored-by: Michael Kohl <citizen428@dev.to> Co-authored-by: Michael Kohl <citizen428@dev.to>
14 lines
476 B
Ruby
14 lines
476 B
Ruby
module Notifications
|
|
class NotifiableActionWorker
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options queue: :low_priority, retry: 10
|
|
def perform(notifiable_id, notifiable_type, action)
|
|
# checking type, but leaving space for notifiable types
|
|
return unless notifiable_type == "Article"
|
|
|
|
notifiable = notifiable_type.constantize.find_by(id: notifiable_id)
|
|
Notifications::NotifiableAction::Send.call(notifiable, action) if notifiable
|
|
end
|
|
end
|
|
end
|