Sha256: 01aea1bd830cb634de2582f35165b9af8201961a3dd9e780aec9b5e361cceec9
Contents?: true
Size: 1.07 KB
Versions: 72
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Decidim # Exposes the report resource so users can report a reportable. class ReportsController < Decidim::ApplicationController include FormFactory include NeedsPermission before_action :authenticate_user! def create enforce_permission_to :create, :moderation @form = form(Decidim::ReportForm).from_params(params) CreateReport.call(@form, reportable, current_user) do on(:ok) do flash[:notice] = I18n.t("decidim.reports.create.success") redirect_back fallback_location: root_path end on(:invalid) do flash[:alert] = I18n.t("decidim.reports.create.error") redirect_back fallback_location: root_path end end end private def reportable @reportable ||= GlobalID::Locator.locate_signed params[:sgid] end def permission_class_chain [ reportable.participatory_space.manifest.permissions_class, Decidim::Permissions ] end def permission_scope :public end end end
Version data entries
72 entries across 72 versions & 1 rubygems