Sha256: 183fc2bee1e6f64b51eacf24decf3bed56fd5b3f2af101c468cb04f504d59c46

Contents?: true

Size: 1.27 KB

Versions: 64

Compression:

Stored size: 1.27 KB

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_url, :manage_moderations_url

    def report(user, report)
      with_user(user) do
        @report = report
        @participatory_space = @report.moderation.participatory_space
        @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
        @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

    private

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

    def manage_moderations_url
      @manage_moderations_url ||= EngineRouter.admin_proxy(@participatory_space).moderations_url(host: @organization.host)
    end
  end
end

Version data entries

64 entries across 64 versions & 2 rubygems

Version Path
decidim-core-0.8.0 app/mailers/decidim/reported_mailer.rb
decidim-core-0.7.4 app/mailers/decidim/reported_mailer.rb
decidim-core-0.7.3 app/mailers/decidim/reported_mailer.rb
decidim-core-0.7.2 app/mailers/decidim/reported_mailer.rb
decidim-core-0.7.1 app/mailers/decidim/reported_mailer.rb
decidim-core-0.7.0 app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.8 app/mailers/decidim/reported_mailer.rb
decidim-0.6.8 decidim-core/app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.7 app/mailers/decidim/reported_mailer.rb
decidim-0.6.7 decidim-core/app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.6 app/mailers/decidim/reported_mailer.rb
decidim-0.6.6 decidim-core/app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.5 app/mailers/decidim/reported_mailer.rb
decidim-0.6.5 decidim-core/app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.4 app/mailers/decidim/reported_mailer.rb
decidim-0.6.4 decidim-core/app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.3 app/mailers/decidim/reported_mailer.rb
decidim-0.6.3 decidim-core/app/mailers/decidim/reported_mailer.rb
decidim-core-0.6.2 app/mailers/decidim/reported_mailer.rb
decidim-0.6.2 decidim-core/app/mailers/decidim/reported_mailer.rb