app/mailers/workarea/admin/comment_mailer.rb in workarea-admin-3.4.45 vs app/mailers/workarea/admin/comment_mailer.rb in workarea-admin-3.5.0.beta.1
- old
+ new
@@ -1,11 +1,11 @@
module Workarea
module Admin
class CommentMailer < Admin::ApplicationMailer
def notify(user_id, comment_id)
- email = User.where(id: user_id).first.email
- return false unless email.present?
+ @user = User.find(user_id) rescue nil
+ return false unless @user&.email.present?
model = Comment.where(id: comment_id).first
return false unless model.present?
return false if model.author_id == user_id
@@ -17,10 +17,10 @@
)
set_colors
mail(
- to: email,
+ to: @user.email,
from: Workarea.config.email_from,
subject: t(
'workarea.admin.comment_mailer.notify.subject',
commentable: @commentable.name
)