summaryrefslogtreecommitdiff
path: root/app/models/label.rb
diff options
context:
space:
mode:
authorjubianchi <contact@jubianchi.fr>2014-08-17 22:22:01 +0200
committerjubianchi <contact@jubianchi.fr>2014-08-20 12:09:19 +0200
commit7ad93ab250019d7737186a0bf8884faf2db2b625 (patch)
treecd75991df1a3fe502549dd4f0a1b1d35ba6ddb58 /app/models/label.rb
parented9e922dd0047435b8d349f0c949ba0a2d789247 (diff)
downloadgitlab-ce-7ad93ab250019d7737186a0bf8884faf2db2b625.tar.gz
Improve labels validation and expose error messages
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index 3ff52416c24..233f477444f 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -6,14 +6,14 @@ class Label < ActiveRecord::Base
has_many :issues, through: :label_links, source: :target, source_type: 'Issue'
validates :color,
- format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ },
+ format: { with: /\A#[0-9A-Fa-f]{6}\Z/ },
allow_blank: false
validates :project, presence: true
# Don't allow '?', '&', and ',' for label titles
validates :title,
presence: true,
- format: { with: /\A[^&\?,&]*\z/ },
+ format: { with: /\A[^&\?,&]+\z/ },
uniqueness: { scope: :project_id }
scope :order_by_name, -> { reorder("labels.title ASC") }