diff options
author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-01 12:00:11 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-03 13:38:59 +0100 |
commit | 9cf67f72a581d4648b2b02b53403dd4318e4f1e9 (patch) | |
tree | d92726459e5608233ef5b4f37633e516fe0fff14 | |
parent | 6689224a90f3d2500be5d927ea1ed9656fc7b1b6 (diff) | |
download | gitlab-ce-9cf67f72a581d4648b2b02b53403dd4318e4f1e9.tar.gz |
Add validator for award-emoji note
-rw-r--r-- | app/models/note.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index 1c6345e735c..40b46b85da1 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -41,6 +41,7 @@ class Note < ActiveRecord::Base validates :note, :project, presence: true validates :note, uniqueness: { scope: [:author, :noteable_type, :noteable_id] }, if: ->(n) { n.is_award } + validates :note, format: { with: /\A[-_+[:alnum:]]*\z/ }, if: -> (n){ n.is_award } validates :line_code, format: { with: /\A[a-z0-9]+_\d+_\d+\Z/ }, allow_blank: true # Attachments are deprecated and are handled by Markdown uploader validates :attachment, file_size: { maximum: :max_attachment_size } |