Skip to content

Commit

Permalink
Fix error when members try to report models
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Jan 20, 2025
1 parent 6132050 commit 30ec154
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ def get_reportable
reportable_param = params[:reportable_class].parameterize + "_id"
id = params[reportable_param]
@reportable = policy_scope(reportable).find_param(id)
authorize @reportable
authorize :"federails/moderation/report"
end
end
11 changes: 11 additions & 0 deletions app/policies/federails/moderation/report_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ def index?
)
end

def new?
all_of(
SiteSettings.multiuser_enabled?,
@user.is_member?
)
end

def create?
new?
end

def show?
index?
end
Expand Down

0 comments on commit 30ec154

Please sign in to comment.