mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-30 18:43:56 +00:00
1060666c58
* Add support for editing for published statuses * Fix references to stripped-out code * Various fixes and improvements * Further fixes and improvements * Fix updates being potentially sent to unauthorized recipients * Various fixes and improvements * Fix wrong words in test * Fix notifying accounts that were tagged but were not in the audience * Fix mistake
22 lines
676 B
Ruby
22 lines
676 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
|
|
|
|
return if Notification.where(account: receiver, activity: activity).any?
|
|
|
|
NotifyService.new.call(receiver, type || activity_class_name.underscore, activity)
|
|
rescue ActiveRecord::RecordNotFound
|
|
true
|
|
end
|
|
end
|