Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/integrations/campfire.rb')
-rw-r--r--app/models/integrations/campfire.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/integrations/campfire.rb b/app/models/integrations/campfire.rb
index bf1358ac0f6..3f7fa1c51b2 100644
--- a/app/models/integrations/campfire.rb
+++ b/app/models/integrations/campfire.rb
@@ -2,7 +2,15 @@
module Integrations
class Campfire < Integration
+ SUBDOMAIN_REGEXP = %r{\A[a-z](?:[a-z0-9-]*[a-z0-9])?\z}i.freeze
+
validates :token, presence: true, if: :activated?
+ validates :room,
+ allow_blank: true,
+ numericality: { only_integer: true, greater_than: 0 }
+ validates :subdomain,
+ allow_blank: true,
+ format: { with: SUBDOMAIN_REGEXP }, length: { in: 1..63 }
field :token,
type: 'password',
@@ -16,6 +24,7 @@ module Integrations
field :subdomain,
title: -> { _('Campfire subdomain (optional)') },
placeholder: '',
+ exposes_secrets: true,
help: -> do
ERB::Util.html_escape(
s_('CampfireService|The %{code_open}.campfirenow.com%{code_close} subdomain.')