Sha256: 6c50bce03d287ed2c4b11bd1d0a2d436cf0628f6d04de6cbecf96affafb3311d

Contents?: true

Size: 952 Bytes

Versions: 4

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true
module Decidim
  # A custom mailer for sending notifications to an admin when a report is created..
  class ReportedMailer < Decidim::ApplicationMailer
    helper Decidim::ResourceHelper

    helper_method :reported_content

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

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

    private

    def reported_content
      @reported_content ||= @report.moderation.reportable.reported_content
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.1.0 app/mailers/decidim/reported_mailer.rb
decidim-core-0.0.8.1 app/mailers/decidim/reported_mailer.rb
decidim-core-0.0.7 app/mailers/decidim/reported_mailer.rb
decidim-core-0.0.6 app/mailers/decidim/reported_mailer.rb