Create new email template for new evaluation comment created and add it to system_emails view

This commit is contained in:
lalo
2019-03-27 12:13:43 +01:00
parent a6f8969728
commit 28815cb290
14 changed files with 248 additions and 8 deletions

View File

@@ -0,0 +1,31 @@
class EvaluationCommentEmail
attr_reader :comment
def initialize(comment)
@comment = comment
end
def commentable
comment.commentable
end
def to
@to ||= related_users
end
def subject
I18n.t("mailers.evaluation_comment.subject")
end
def can_be_sent?
commentable.present? && to.any?
end
private
def related_users
return [] if comment.commentable.nil?
comment.commentable
.admin_and_valuator_users_associated
.reject { |associated_user| associated_user.user == comment.author }
end
end