Class: Decidim::ReportedMailer
- Inherits:
-
ApplicationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- Decidim::ReportedMailer
- Defined in:
- decidim-core/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
-
#current_organization ⇒ Object
See comment for reported_content_cell.
- #current_user ⇒ Object
-
#hidden_automatically(user, report) ⇒ Object
This is meant to be used when a resource is hidden by an algorithm, such as the
decidim-aimodule, or theDecidim.max_reports_before_hidingfeature. -
#hidden_manually(user, report, current_user) ⇒ Object
This is used when a user with special rights (like an administrator, a space administrator or a moderator) hides a resource.
- #report(user, report) ⇒ Object
Methods included from OrganizationHelper
#current_organization_name, #organization_colors, #organization_description_label, #organization_name
Methods included from TranslatableAttributes
#attachment?, #default_locale?
Methods included from SanitizeHelper
#decidim_escape_translated, #decidim_html_escape, #decidim_rich_text, #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_organization ⇒ Object
See comment for reported_content_cell
52 53 54 |
# File 'decidim-core/app/mailers/decidim/reported_mailer.rb', line 52 def current_organization @organization end |
#current_user ⇒ Object
56 57 58 |
# File 'decidim-core/app/mailers/decidim/reported_mailer.rb', line 56 def current_user @user end |
#hidden_automatically(user, report) ⇒ Object
This is meant to be used when a resource is hidden by an algorithm, such as the decidim-ai module, or the Decidim.max_reports_before_hiding feature.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'decidim-core/app/mailers/decidim/reported_mailer.rb', line 39 def hidden_automatically(user, report) with_user(user) do @report = report @participatory_space = @report.moderation.participatory_space @reportable = @report.moderation.reportable @organization = user.organization @user = user subject = I18n.t("hidden_automatically.subject", scope: "decidim.reported_mailer") mail(to: user.email, subject:) end end |
#hidden_manually(user, report, current_user) ⇒ Object
This is used when a user with special rights (like an administrator, a space administrator or a moderator) hides a resource
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'decidim-core/app/mailers/decidim/reported_mailer.rb', line 25 def hidden_manually(user, report, current_user) with_user(user) do @report = report @participatory_space = @report.moderation.participatory_space @reportable = @report.moderation.reportable @organization = user.organization @user = user @moderator = current_user subject = I18n.t("hidden_manually.subject", scope: "decidim.reported_mailer", moderator: @moderator.name) 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 'decidim-core/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 |