Minor changes to workers.
This commit is contained in:
parent
48ba509234
commit
440a1ce6ff
|
@ -15,6 +15,7 @@ class IntroduceAccountProWorker
|
||||||
private
|
private
|
||||||
|
|
||||||
def deliver_email(date_range)
|
def deliver_email(date_range)
|
||||||
|
return if @acct.nil? or @acct.user.nil?
|
||||||
UserMailer.introduce_pro(@acct.user, date_range).deliver_now!
|
UserMailer.introduce_pro(@acct.user, date_range).deliver_now!
|
||||||
@acct.user.touch(:last_emailed_at)
|
@acct.user.touch(:last_emailed_at)
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,13 +4,10 @@ class LocalNotificationWorker
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
|
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
|
||||||
if activity_id.nil? && activity_class_name.nil?
|
return true if activity_id.nil? or activity_class_name.nil?
|
||||||
activity = Mention.find(receiver_account_id)
|
|
||||||
receiver = activity.account
|
|
||||||
else
|
|
||||||
receiver = Account.find(receiver_account_id)
|
receiver = Account.find(receiver_account_id)
|
||||||
activity = activity_class_name.constantize.find(activity_id)
|
activity = activity_class_name.constantize.find(activity_id)
|
||||||
end
|
|
||||||
|
|
||||||
NotifyService.new.call(receiver, activity)
|
NotifyService.new.call(receiver, activity)
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
Loading…
Reference in New Issue