You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
598 B

  1. # frozen_string_literal: true
  2. class LocalNotificationWorker
  3. include Sidekiq::Worker
  4. def perform(receiver_account_id, activity_id = nil, activity_class_name = nil, type = nil)
  5. if activity_id.nil? && activity_class_name.nil?
  6. activity = Mention.find(receiver_account_id)
  7. receiver = activity.account
  8. else
  9. receiver = Account.find(receiver_account_id)
  10. activity = activity_class_name.constantize.find(activity_id)
  11. end
  12. NotifyService.new.call(receiver, type || activity_class_name.underscore, activity)
  13. rescue ActiveRecord::RecordNotFound
  14. true
  15. end
  16. end