Projects with the identifiers "autocomplete" or "bulk_destroy" cannot perform some operations (#43910).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@24549 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2026-04-02 00:26:00 +00:00
parent 3e5cfc0b1f
commit 8cc1ea47ce
2 changed files with 5 additions and 1 deletions

View File

@@ -86,7 +86,9 @@ class Project < ApplicationRecord
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/,
:if => proc {|p| p.identifier_changed?}
# reserved words
validates_exclusion_of :identifier, :in => %w(new)
validates_exclusion_of :identifier,
:in => %w(new autocomplete bulk_destroy),
:if => -> { new_record? || will_save_change_to_identifier? }
validate :validate_parent
after_update :update_versions_from_hierarchy_change,

View File

@@ -96,6 +96,8 @@ class ProjectTest < ActiveSupport::TestCase
"ab-12" => true,
"ab_12" => true,
"12" => false,
"autocomplete" => false,
'bulk_destroy' => false,
"new" => false}
to_test.each do |identifier, valid|