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

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#default_locale?

Methods included from SanitizeHelper

#decidim_escape_translated, #decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included

Instance Method Details

#current_organizationObject

See comment for reported_content_cell



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

def current_organization
  @organization
end

#current_userObject



40
41
42
# File 'app/mailers/decidim/reported_mailer.rb', line 40

def current_user
  @user
end

#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:)
  end
end

#report(user, report) ⇒ Object



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

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:)
  end
end