Minor changes to workers.

This commit is contained in:
Fosco Marotto 2021-02-01 03:43:56 -05:00
parent 48ba509234
commit 440a1ce6ff
2 changed files with 5 additions and 7 deletions

View File

@ -15,6 +15,7 @@ class IntroduceAccountProWorker
private
def deliver_email(date_range)
return if @acct.nil? or @acct.user.nil?
UserMailer.introduce_pro(@acct.user, date_range).deliver_now!
@acct.user.touch(:last_emailed_at)
end

View File

@ -4,13 +4,10 @@ class LocalNotificationWorker
include Sidekiq::Worker
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
if activity_id.nil? && activity_class_name.nil?
activity = Mention.find(receiver_account_id)
receiver = activity.account
else
return true if activity_id.nil? or activity_class_name.nil?
receiver = Account.find(receiver_account_id)
activity = activity_class_name.constantize.find(activity_id)
end
NotifyService.new.call(receiver, activity)
rescue ActiveRecord::RecordNotFound