Class: Decidim::Comments::CommentNotificationMailer

Inherits:
ApplicationMailer
  • Object
show all
Defined in:
decidim-comments/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(comment, commentable) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb', line 12

def comment_created(comment, commentable)
  with_user(commentable.author) do
    @comment = comment
    @commentable = commentable
    @locator = Decidim::ResourceLocatorPresenter.new(@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(reply, comment, commentable) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb', line 23

def reply_created(reply, comment, commentable)
  with_user(comment.author) do
    @reply = reply
    @comment = comment
    @commentable = commentable
    @locator = Decidim::ResourceLocatorPresenter.new(@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