Unverified Commit ecabefba authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

More strict validation for label title


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 65fb8ca13516
......@@ -2,9 +2,11 @@ class Label < ActiveRecord::Base
belongs_to :project
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 :title, presence: true
# Dont allow '?', '&', and ',' for label titles
validates :title, presence: true, format: { with: /\A[^&\?,&]*\z/ }
def name
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