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

#current_organizationObject

See comment for reported_content_cell



37
38
39
# File 'app/mailers/decidim/reported_mailer.rb', line 37

def current_organization
  @organization
end

#hide(user, report) ⇒ Object



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

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
23
# File 'app/mailers/decidim/reported_mailer.rb', line 11

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