Class: Decidim::ReportedMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/decidim/reported_mailer.rb

Overview

A custom mailer for sending notifications to an admin when a report is created..

Instance Method Summary collapse

Instance Method Details

#hide(user, report) ⇒ Object



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

def hide(user, report)
  with_user(user) do
    @report = report
    @participatory_space = @report.moderation.participatory_space
    @organization = user.organization
    @user = user
    subject = I18n.t("hide.subject", scope: "decidim.reported_mailer")
    mail(to: user.email, subject: subject)
  end
end

#report(user, report) ⇒ Object



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

def report(user, report)
  with_user(user) do
    @report = report
    @participatory_space = @report.moderation.participatory_space
    @organization = user.organization
    @user = user
    @author = @report.moderation.reportable.try(:creator_identity) || @report.moderation.reportable.try(:author)
    @content = { title: @report.moderation.reportable.try(:title), body: @report.moderation.reportable.try(:body) }.compact
    subject = I18n.t("report.subject", scope: "decidim.reported_mailer")
    mail(to: user.email, subject: subject)
  end
end