Sha256: 5a1998580ccf77ebf4cd90a1db4567259cb958ba53411e84fa6c0ae1916c32de

Contents?: true

Size: 1008 Bytes

Versions: 6

Compression:

Stored size: 1008 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    module Moderations
      # This controller allows admins to manage reports in a moderation.
      class ReportsController < Decidim::Admin::ApplicationController
        helper_method :moderation, :reports, :authorization_scope

        def index
          enforce_permission_to :read, authorization_scope
        end

        def show
          enforce_permission_to :read, authorization_scope
          @report = reports.find(params[:id])
        end

        private

        def reports
          @reports ||= moderation.reports
        end

        def moderation
          @moderation ||= participatory_space_moderations.find(params[:moderation_id])
        end

        def participatory_space_moderations
          @participatory_space_moderations ||= Decidim::Moderation.where(participatory_space: current_participatory_space)
        end

        def authorization_scope
          :moderation
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.29.1 app/controllers/decidim/admin/moderations/reports_controller.rb
decidim-admin-0.29.0 app/controllers/decidim/admin/moderations/reports_controller.rb
decidim-admin-0.29.0.rc4 app/controllers/decidim/admin/moderations/reports_controller.rb
decidim-admin-0.29.0.rc3 app/controllers/decidim/admin/moderations/reports_controller.rb
decidim-admin-0.29.0.rc2 app/controllers/decidim/admin/moderations/reports_controller.rb
decidim-admin-0.29.0.rc1 app/controllers/decidim/admin/moderations/reports_controller.rb