forked from e621ng/e621ng
[WikiPages] Restrict skip_secondary_validations to Janitor+ (#639)
This commit is contained in:
parent
166d6ea350
commit
516e3391be
@ -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)
|
||||
|
@ -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 %>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user