mirror of
https://github.com/whippyshou/mastodon
synced 2024-11-25 15:46:35 +09:00
974b1b79ce
* Add bell button Fix #4890 * Remove duplicate type from post-deployment migration * Fix legacy class type mappings * Improve query performance with better index * Fix validation * Remove redundant index from notifications
20 lines
598 B
Ruby
20 lines
598 B
Ruby
# frozen_string_literal: true
|
|
|
|
class LocalNotificationWorker
|
|
include Sidekiq::Worker
|
|
|
|
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil, type = nil)
|
|
if activity_id.nil? && activity_class_name.nil?
|
|
activity = Mention.find(receiver_account_id)
|
|
receiver = activity.account
|
|
else
|
|
receiver = Account.find(receiver_account_id)
|
|
activity = activity_class_name.constantize.find(activity_id)
|
|
end
|
|
|
|
NotifyService.new.call(receiver, type || activity_class_name.underscore, activity)
|
|
rescue ActiveRecord::RecordNotFound
|
|
true
|
|
end
|
|
end
|