Class: Decidim::Comments::CommentNotificationMailer

Inherits:
ApplicationMailer
  • Object
show all
Defined in:
app/mailers/decidim/comments/comment_notification_mailer.rb

Overview

A custom mailer for sending notifications to users when a comment is created.

Instance Method Summary collapse

Instance Method Details

#comment_created(user, comment, commentable) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'app/mailers/decidim/comments/comment_notification_mailer.rb', line 9

def comment_created(user, comment, commentable)
  with_user(user) do
    @comment = comment
    @commentable = commentable
    @organization = commentable.organization
    subject = I18n.t("comment_created.subject", scope: "decidim.comments.mailer.comment_notification")
    mail(to: commentable.author.email, subject: subject)
  end
end

#reply_created(user, reply, comment, commentable) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'app/mailers/decidim/comments/comment_notification_mailer.rb', line 19

def reply_created(user, reply, comment, commentable)
  with_user(user) do
    @reply = reply
    @comment = comment
    @commentable = commentable
    @organization = commentable.organization
    subject = I18n.t("reply_created.subject", scope: "decidim.comments.mailer.comment_notification")
    mail(to: comment.author.email, subject: subject)
  end
end