debian-mirror-gitlab/app/validators/zoom_url_validator.rb

14 lines
326 B
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
# ZoomUrlValidator
#
# Custom validator for zoom urls
#
class ZoomUrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if Gitlab::ZoomLinkExtractor.new(value).links.size == 1
record.errors.add(:url, 'must contain one valid Zoom URL')
end
end