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(user, comment, commentable) ⇒ Object



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

def comment_created(user, comment, commentable)
  with_user(user) do
    @user = user
    @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: user.email, subject: subject)
  end
end

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



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

def reply_created(user, reply, comment, commentable)
  with_user(user) do
    @user = user
    @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: user.email, subject: subject)
  end
end