diff --git a/app/workers/introduce_account_pro_worker.rb b/app/workers/introduce_account_pro_worker.rb index 520faa0b..3dc55f9c 100644 --- a/app/workers/introduce_account_pro_worker.rb +++ b/app/workers/introduce_account_pro_worker.rb @@ -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 diff --git a/app/workers/local_notification_worker.rb b/app/workers/local_notification_worker.rb index 48635e49..9a4cbe21 100644 --- a/app/workers/local_notification_worker.rb +++ b/app/workers/local_notification_worker.rb @@ -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