Commit ecabefba authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

More strict validation for label title

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 4c6859a2
...@@ -2,9 +2,11 @@ class Label < ActiveRecord::Base ...@@ -2,9 +2,11 @@ class Label < ActiveRecord::Base
belongs_to :project belongs_to :project
has_many :label_links, dependent: :destroy has_many :label_links, dependent: :destroy
validates :color, format: { with: /\A\#[0-9A-Fa-f]{3}{1,2}+\Z/ }, allow_blank: true validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true
validates :project, presence: true validates :project, presence: true
validates :title, presence: true
# Dont allow '?', '&', and ',' for label titles
validates :title, presence: true, format: { with: /\A[^&\?,&]*\z/ }
def name def name
title title
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment