Sha256: d6b760427b44541b09f4b2181d44a11e1d76798b00333e439d9394a0e971edaf
Contents?: true
Size: 976 Bytes
Versions: 37
Compression:
Stored size: 976 Bytes
Contents
# frozen_string_literal: true module Decidim class ReportUsersController < ApplicationController include FormFactory include NeedsPermission before_action :authenticate_user! def create enforce_permission_to :create, :user_report @form = form(Decidim::ReportForm).from_params(params) CreateUserReport.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 [Decidim::ReportUserPermissions, Decidim::Permissions] end def permission_scope :public end end end
Version data entries
37 entries across 37 versions & 1 rubygems