summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-01-26 14:48:47 +0100
committerJames Lopez <james@jameslopez.es>2018-01-26 15:26:27 +0100
commit41a14498c7d6fc1c422c9507393e889f96d964dc (patch)
tree217615cbc4e3cc14d0f585ce7f7c317be36dc4a5 /app/models
parent4131b6e9e32acc7317704018801c96342ea8b578 (diff)
downloadgitlab-ce-41a14498c7d6fc1c422c9507393e889f96d964dc.tar.gz
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project_services/emails_on_push_service.rb2
-rw-r--r--app/models/project_services/irker_service.rb2
-rw-r--r--app/models/project_services/pipelines_email_service.rb2
-rw-r--r--app/models/service.rb4
4 files changed, 7 insertions, 3 deletions
diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb
index 62c8dfc6cc3..b604d860a87 100644
--- a/app/models/project_services/emails_on_push_service.rb
+++ b/app/models/project_services/emails_on_push_service.rb
@@ -2,7 +2,7 @@ class EmailsOnPushService < Service
boolean_accessor :send_from_committer_email
boolean_accessor :disable_diffs
prop_accessor :recipients
- validates :recipients, presence: true, if: :activated?, unless: :importing?
+ validates :recipients, presence: true, if: :valid_recipients?
def title
'Emails on push'
diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb
index 3d01cc73535..27bdf708c80 100644
--- a/app/models/project_services/irker_service.rb
+++ b/app/models/project_services/irker_service.rb
@@ -4,7 +4,7 @@ class IrkerService < Service
prop_accessor :server_host, :server_port, :default_irc_uri
prop_accessor :recipients, :channels
boolean_accessor :colorize_messages
- validates :recipients, presence: true, if: :activated?, unless: :importing?
+ validates :recipients, presence: true, if: :valid_recipients?
before_validation :get_channels
diff --git a/app/models/project_services/pipelines_email_service.rb b/app/models/project_services/pipelines_email_service.rb
index 267ac80e0ca..9c7b58dead5 100644
--- a/app/models/project_services/pipelines_email_service.rb
+++ b/app/models/project_services/pipelines_email_service.rb
@@ -1,7 +1,7 @@
class PipelinesEmailService < Service
prop_accessor :recipients
boolean_accessor :notify_only_broken_pipelines
- validates :recipients, presence: true, if: :activated?, unless: :importing?
+ validates :recipients, presence: true, if: :valid_recipients?
def initialize_properties
self.properties ||= { notify_only_broken_pipelines: true }
diff --git a/app/models/service.rb b/app/models/service.rb
index 5daa70541ab..369cae2e85f 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -297,4 +297,8 @@ class Service < ActiveRecord::Base
project.cache_has_external_wiki
end
end
+
+ def valid_recipients?
+ activated? && !importing?
+ end
end