[WikiPages] Restrict skip_secondary_validations to Janitor+ (#639)

This commit is contained in:
Donovan Daniels 2024-08-02 09:44:21 -05:00 committed by Cinder
parent 166d6ea350
commit 516e3391be
2 changed files with 3 additions and 3 deletions

View File

@ -123,9 +123,9 @@ class WikiPagesController < ApplicationController
end
def wiki_page_params(context)
permitted_params = %i[body skip_secondary_validations edit_reason]
permitted_params = %i[body edit_reason]
permitted_params += %i[parent] if CurrentUser.is_privileged?
permitted_params += %i[is_locked is_deleted] if CurrentUser.is_janitor?
permitted_params += %i[is_locked is_deleted skip_secondary_validations] if CurrentUser.is_janitor?
permitted_params += %i[title] if context == :create || CurrentUser.is_janitor?
params.fetch(:wiki_page, {}).permit(permitted_params)

View File

@ -24,7 +24,7 @@
<%= f.input :edit_reason, label: "Edit Reason" %>
<% if @wiki_page.errors[:title].present? %>
<% if CurrentUser.is_janitor? && @wiki_page.errors[:title]&.any? { |error| error.include?("Move the posts and update any wikis linking to this page first.") } %>
<%= f.input :skip_secondary_validations, as: :boolean, label: "Force rename", hint: "Ignore the renaming requirements" %>
<% end %>