Skip to content

Commit

Permalink
Merge pull request #61 from makimoto/slack-hash
Browse files Browse the repository at this point in the history
Fix length validation for slack_channel column to adapt # symbol
  • Loading branch information
makimoto authored May 22, 2017
2 parents c836375 + 859b770 commit c1bc666
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/kuroko2/job_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ module PreventMultiStatus
validate :script_syntax
validate :validate_number_of_admins
validates :hipchat_additional_text, length: { maximum: 180 }
validates :slack_channel, length: { maximum: 21 }, format: {
with: /\A#[^\.\s]+\z/, allow_blank: true,
message: ' must start with # and must not include any dots or spaces'
}
validates :slack_channel,
length: { maximum: 22, too_long: ' is too long (maximum is 21 characters without `#` symbol at the head)' },
format: {
with: /\A#[^\.\s]+\z/, allow_blank: true,
message: ' must start with # and must not include any dots or spaces'
}
validates :webhook_url, format: { with: /\A#{URI::regexp(%w(http https))}\z/, allow_blank: true }

def proceed_multi_instance?
Expand Down

0 comments on commit c1bc666

Please sign in to comment.