0001-Fix-DEPRECATION-WARNING-Uniqueness-validator-will-no.patch

Marius BALTEANU, 2021-03-30 18:41

Download (10.6 KB)

View differences:

Gemfile
3 3
ruby '>= 2.4.0', '< 2.8.0'
4 4
gem 'bundler', '>= 1.12.0'
5 5

  
6
gem 'rails', '5.2.5'
6
gem 'rails', '6.1.3.1'
7 7
gem 'sprockets', '~> 3.7.2' if RUBY_VERSION < '2.5'
8 8
gem 'rouge', '~> 3.26.0'
9 9
gem 'request_store', '~> 1.5.0'
app/models/auth_source.rb
30 30
  has_many :users
31 31

  
32 32
  validates_presence_of :name
33
  validates_uniqueness_of :name
33
  validates_uniqueness_of :name, :case_sensitive => true
34 34
  validates_length_of :name, :maximum => 60
35 35

  
36 36
  safe_attributes(
app/models/changeset.rb
52 52
                            :scope => proc {preload(:user, {:repository => :project})}
53 53

  
54 54
  validates_presence_of :repository_id, :revision, :committed_on, :commit_date
55
  validates_uniqueness_of :revision, :scope => :repository_id
56
  validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
55
  validates_uniqueness_of :revision, :scope => :repository_id, :case_sensitive => true
56
  validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true, :case_sensitive => true
57 57

  
58 58
  scope :visible, (lambda do |*args|
59 59
    joins(:repository => :project).
app/models/custom_field.rb
34 34
  store :format_store
35 35

  
36 36
  validates_presence_of :name, :field_format
37
  validates_uniqueness_of :name, :scope => :type
37
  validates_uniqueness_of :name, :scope => :type, :case_sensitive => true
38 38
  validates_length_of :name, :maximum => 30
39 39
  validates_length_of :regexp, maximum: 255
40 40
  validates_inclusion_of :field_format,
app/models/enabled_module.rb
22 22
  acts_as_watchable
23 23

  
24 24
  validates_presence_of :name
25
  validates_uniqueness_of :name, :scope => :project_id
25
  validates_uniqueness_of :name, :scope => :project_id, :case_sensitive => true
26 26

  
27 27
  after_create :module_enabled
28 28

  
app/models/enumeration.rb
32 32
  before_save    :check_default
33 33

  
34 34
  validates_presence_of :name
35
  validates_uniqueness_of :name, :scope => [:type, :project_id]
35
  validates_uniqueness_of :name, :scope => [:type, :project_id], :case_sensitive => true
36 36
  validates_length_of :name, :maximum => 30
37 37

  
38 38
  scope :shared, lambda {where(:project_id => nil)}
app/models/issue_category.rb
24 24
  has_many :issues, :foreign_key => 'category_id', :dependent => :nullify
25 25

  
26 26
  validates_presence_of :name
27
  validates_uniqueness_of :name, :scope => [:project_id]
27
  validates_uniqueness_of :name, :scope => [:project_id], :case_sensitive => true
28 28
  validates_length_of :name, :maximum => 60
29 29

  
30 30
  safe_attributes 'name', 'assigned_to_id'
app/models/issue_relation.rb
72 72
  validates_presence_of :issue_from, :issue_to, :relation_type
73 73
  validates_inclusion_of :relation_type, :in => TYPES.keys
74 74
  validates_numericality_of :delay, :allow_nil => true
75
  validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
75
  validates_uniqueness_of :issue_to_id, :scope => :issue_from_id, :case_sensitive => true
76 76
  validate :validate_issue_relation
77 77

  
78 78
  before_save :handle_issue_order
app/models/issue_status.rb
29 29
  before_destroy :delete_workflow_rules
30 30

  
31 31
  validates_presence_of :name
32
  validates_uniqueness_of :name
32
  validates_uniqueness_of :name, :case_sensitive => true
33 33
  validates_length_of :name, :maximum => 30
34 34
  validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
35 35

  
app/models/member.rb
25 25
  belongs_to :project
26 26

  
27 27
  validates_presence_of :principal, :project
28
  validates_uniqueness_of :user_id, :scope => :project_id
28
  validates_uniqueness_of :user_id, :scope => :project_id, :case_sensitive => true
29 29
  validate :validate_role
30 30

  
31 31
  before_destroy :set_issue_category_nil, :remove_from_project_default_assigned_to
app/models/project.rb
72 72
                :author => nil
73 73

  
74 74
  validates_presence_of :name, :identifier
75
  validates_uniqueness_of :identifier, :if => proc {|p| p.identifier_changed?}
75
  validates_uniqueness_of :identifier, :if => proc {|p| p.identifier_changed?}, :case_sensitive => true
76 76
  validates_length_of :name, :maximum => 255
77 77
  validates_length_of :homepage, :maximum => 255
78 78
  validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH
app/models/repository.rb
43 43
  validates_length_of :password, :maximum => 255, :allow_nil => true
44 44
  validates_length_of :root_url, :url, maximum: 255
45 45
  validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
46
  validates_uniqueness_of :identifier, :scope => :project_id
46
  validates_uniqueness_of :identifier, :scope => :project_id, :case_sensitive => true
47 47
  validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision)
48 48
  # donwcase letters, digits, dashes, underscores but not digits only
49 49
  validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true
app/models/role.rb
76 76
  store :settings, :accessors => [:permissions_all_trackers, :permissions_tracker_ids]
77 77

  
78 78
  validates_presence_of :name
79
  validates_uniqueness_of :name
79
  validates_uniqueness_of :name, :case_sensitive => true
80 80
  validates_length_of :name, :maximum => 255
81 81
  validates_inclusion_of(
82 82
    :issues_visibility,
app/models/setting.rb
85 85

  
86 86
  validates_uniqueness_of(
87 87
    :name,
88
    :case_sensitive => true,
88 89
    :if => Proc.new do |setting|
89 90
      setting.new_record? || setting.name_changed?
90 91
    end
app/models/token.rb
19 19

  
20 20
class Token < ActiveRecord::Base
21 21
  belongs_to :user
22
  validates_uniqueness_of :value
22
  validates_uniqueness_of :value, :case_sensitive => true
23 23

  
24 24
  before_create :delete_previous_tokens, :generate_new_token
25 25

  
app/models/tracker.rb
40 40

  
41 41
  validates_presence_of :default_status
42 42
  validates_presence_of :name
43
  validates_uniqueness_of :name
43
  validates_uniqueness_of :name, :case_sensitive => true
44 44
  validates_length_of :name, :maximum => 30
45 45
  validates_length_of :description, :maximum => 255
46 46

  
app/models/version.rb
127 127
  VERSION_SHARINGS = %w(none descendants hierarchy tree system)
128 128

  
129 129
  validates_presence_of :name
130
  validates_uniqueness_of :name, :scope => [:project_id]
130
  validates_uniqueness_of :name, :scope => [:project_id], :case_sensitive => true
131 131
  validates_length_of :name, :maximum => 60
132 132
  validates_length_of :description, :wiki_page_title, :maximum => 255
133 133
  validates :effective_date, :date => true
app/models/watcher.rb
22 22
  belongs_to :user, :class_name => 'Principal'
23 23

  
24 24
  validates_presence_of :user
25
  validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
25
  validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id], :case_sensitive => true
26 26
  validate :validate_user
27 27

  
28 28
  # Returns true if at least one object among objects is watched by user
29
-