Project

General

Profile

Defect #32897 » 0001-Fix-DEPRECATION-WARNING-Uniqueness-validator-will-no.patch

Marius BĂLTEANU, 2020-01-28 22:35

View differences:

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
46 46
                            :scope => preload(:user, {:repository => :project})
47 47

  
48 48
  validates_presence_of :repository_id, :revision, :committed_on, :commit_date
49
  validates_uniqueness_of :revision, :scope => :repository_id
50
  validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
49
  validates_uniqueness_of :revision, :scope => :repository_id, :case_sensitive => true
50
  validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true, :case_sensitive => true
51 51

  
52 52
  scope :visible, lambda {|*args|
53 53
    joins(:repository => :project).
app/models/custom_field.rb
32 32
  store :format_store
33 33

  
34 34
  validates_presence_of :name, :field_format
35
  validates_uniqueness_of :name, :scope => :type
35
  validates_uniqueness_of :name, :scope => :type, :case_sensitive => true
36 36
  validates_length_of :name, :maximum => 30
37 37
  validates_length_of :regexp, maximum: 255
38 38
  validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats }
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
70 70
                :author => nil
71 71

  
72 72
  validates_presence_of :name, :identifier
73
  validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}
73
  validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}, :case_sensitive => true
74 74
  validates_length_of :name, :maximum => 255
75 75
  validates_length_of :homepage, :maximum => 255
76 76
  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
  cattr_accessor :available_settings
86 86
  self.available_settings ||= {}
87 87

  
88
  validates_uniqueness_of :name, :if => Proc.new {|setting| setting.new_record? || setting.name_changed?}
88
  validates_uniqueness_of :name, :case_sensitive => true, :if => Proc.new {|setting| setting.new_record? || setting.name_changed?}
89 89
  validates_inclusion_of :name, :in => Proc.new {available_settings.keys}
90 90
  validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting|
91 91
    (s = available_settings[setting.name]) && s['format'] == 'int'
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
36 36

  
37 37
  validates_presence_of :default_status
38 38
  validates_presence_of :name
39
  validates_uniqueness_of :name
39
  validates_uniqueness_of :name, :case_sensitive => true
40 40
  validates_length_of :name, :maximum => 30
41 41
  validates_length_of :description, :maximum => 255
42 42

  
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
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
    (1-1/1)