Minor changes to workers.
This commit is contained in:
parent
48ba509234
commit
440a1ce6ff
|
@ -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
|
||||
|
|
|
@ -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
|
||||
receiver = Account.find(receiver_account_id)
|
||||
activity = activity_class_name.constantize.find(activity_id)
|
||||
end
|
||||
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)
|
||||
|
||||
NotifyService.new.call(receiver, activity)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
Loading…
Reference in New Issue