From 308133be453295afe3821bed85c71e083e5ed9c4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 26 Nov 2016 09:04:12 +0000 Subject: [PATCH] Merged r15989 and r15991 (#24283). git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16003 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/custom_field.rb | 1 + app/models/repository.rb | 2 ++ app/models/user.rb | 1 + app/models/version.rb | 2 +- app/models/wiki.rb | 1 + app/models/wiki_page.rb | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 370ce7090..20f3e7b85 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -31,6 +31,7 @@ class CustomField < ActiveRecord::Base validates_presence_of :name, :field_format validates_uniqueness_of :name, :scope => :type validates_length_of :name, :maximum => 30 + validates_length_of :regexp, maximum: 30 validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats } validate :validate_custom_field attr_protected :id diff --git a/app/models/repository.rb b/app/models/repository.rb index 3e46570ee..90c2e49ac 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -37,7 +37,9 @@ class Repository < ActiveRecord::Base # has_many :changesets, :dependent => :destroy is too slow for big repositories before_destroy :clear_changesets + validates_length_of :login, maximum: 60, allow_nil: true validates_length_of :password, :maximum => 255, :allow_nil => true + validates_length_of :root_url, :url, maximum: 255 validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_uniqueness_of :identifier, :scope => :project_id validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision) diff --git a/app/models/user.rb b/app/models/user.rb index 0fc740520..5209fcb46 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -111,6 +111,7 @@ class User < Principal validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT validates_length_of :firstname, :lastname, :maximum => 30 + validates_length_of :identity_url, maximum: 255 validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true validate :validate_password_length validate do diff --git a/app/models/version.rb b/app/models/version.rb index bc71b72e9..5c633d46b 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -34,7 +34,7 @@ class Version < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :scope => [:project_id] validates_length_of :name, :maximum => 60 - validates_length_of :description, :maximum => 255 + validates_length_of :description, :wiki_page_title, :maximum => 255 validates :effective_date, :date => true validates_inclusion_of :status, :in => VERSION_STATUSES validates_inclusion_of :sharing, :in => VERSION_SHARINGS diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 188cb5b6c..b4cf76595 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -25,6 +25,7 @@ class Wiki < ActiveRecord::Base validates_presence_of :start_page validates_format_of :start_page, :with => /\A[^,\.\/\?\;\|\:]*\z/ + validates_length_of :start_page, maximum: 255 attr_protected :id before_destroy :delete_redirects diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index ae1e74cca..9922fa4be 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -45,6 +45,7 @@ class WikiPage < ActiveRecord::Base validates_presence_of :title validates_format_of :title, :with => /\A[^,\.\/\?\;\|\s]*\z/ validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false + validates_length_of :title, maximum: 255 validates_associated :content attr_protected :id -- 2.39.5