Remove deprecated single-argument variation of UnfilterNotificationsWorker
(#33353)
This commit is contained in:
parent
498372fd06
commit
6deadd596d
2 changed files with 15 additions and 30 deletions
|
@ -4,25 +4,14 @@ class UnfilterNotificationsWorker
|
|||
include Sidekiq::Worker
|
||||
include Redisable
|
||||
|
||||
# Earlier versions of the feature passed a `notification_request` ID
|
||||
# If `to_account_id` is passed, the first argument is an account ID
|
||||
# TODO for after 4.3.0: drop the single-argument case
|
||||
def perform(notification_request_or_account_id, from_account_id = nil)
|
||||
if from_account_id.present?
|
||||
@notification_request = nil
|
||||
@from_account = Account.find_by(id: from_account_id)
|
||||
@recipient = Account.find_by(id: notification_request_or_account_id)
|
||||
else
|
||||
@notification_request = NotificationRequest.find_by(id: notification_request_or_account_id)
|
||||
@from_account = @notification_request&.from_account
|
||||
@recipient = @notification_request&.account
|
||||
end
|
||||
def perform(account_id, from_account_id)
|
||||
@from_account = Account.find_by(id: from_account_id)
|
||||
@recipient = Account.find_by(id: account_id)
|
||||
|
||||
return if @from_account.nil? || @recipient.nil?
|
||||
|
||||
push_to_conversations!
|
||||
unfilter_notifications!
|
||||
remove_request!
|
||||
decrement_worker_count!
|
||||
end
|
||||
|
||||
|
@ -36,10 +25,6 @@ class UnfilterNotificationsWorker
|
|||
filtered_notifications.in_batches.update_all(filtered: false)
|
||||
end
|
||||
|
||||
def remove_request!
|
||||
@notification_request&.destroy!
|
||||
end
|
||||
|
||||
def filtered_notifications
|
||||
Notification.where(account: @recipient, from_account: @from_account, filtered: true)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue