summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-01-25 16:21:23 +0100
committerJames Lopez <james@jameslopez.es>2018-01-26 15:26:25 +0100
commit482fc5537f8273d82fadde7a68b609eda3e64543 (patch)
tree9e1319bb36d6355d75019a3468b403916551393e /app/models
parent4376be84ce18cde22febc50356ad254b507eef1b (diff)
downloadgitlab-ce-482fc5537f8273d82fadde7a68b609eda3e64543.tar.gz
fix validation error on services
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.rb2
4 files changed, 5 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 1a236e232f9..62c8dfc6cc3 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?
+ validates :recipients, presence: true, if: :activated?, unless: :importing?
def title
'Emails on push'
diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb
index 19357f90810..3d01cc73535 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?
+ validates :recipients, presence: true, if: :activated?, unless: :importing?
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 6a3118a11b8..267ac80e0ca 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?
+ validates :recipients, presence: true, if: :activated?, unless: :importing?
def initialize_properties
self.properties ||= { notify_only_broken_pipelines: true }
diff --git a/app/models/service.rb b/app/models/service.rb
index 96a064697f0..5daa70541ab 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -2,6 +2,8 @@
# and implement a set of methods
class Service < ActiveRecord::Base
include Sortable
+ include Importable
+
serialize :properties, JSON # rubocop:disable Cop/ActiveRecordSerialize
default_value_for :active, false