Change default values
This commit is contained in:
parent
e365750199
commit
71e6a93db9
|
@ -24,7 +24,12 @@ class BuildsEmailService < Service
|
|||
boolean_accessor :notify_only_broken_builds
|
||||
validates :recipients, presence: true, if: :activated?
|
||||
|
||||
default_value_for :notify_only_broken_builds, true
|
||||
def initialize_properties
|
||||
if properties.nil?
|
||||
self.properties = {}
|
||||
self.notify_only_broken_builds = true
|
||||
end
|
||||
end
|
||||
|
||||
def title
|
||||
'Builds emails'
|
||||
|
|
|
@ -25,7 +25,12 @@ class HipchatService < Service
|
|||
boolean_accessor :notify_only_broken_builds
|
||||
validates :token, presence: true, if: :activated?
|
||||
|
||||
default_value_for :notify_only_broken_builds, true
|
||||
def initialize_properties
|
||||
if properties.nil?
|
||||
self.properties = {}
|
||||
self.notify_only_broken_builds = true
|
||||
end
|
||||
end
|
||||
|
||||
def title
|
||||
'HipChat'
|
||||
|
|
|
@ -56,12 +56,16 @@ class IssueTrackerService < Service
|
|||
end
|
||||
|
||||
def initialize_properties
|
||||
if new_record?
|
||||
if properties.nil?
|
||||
if enabled_in_gitlab_config
|
||||
self.title = issues_tracker['title']
|
||||
self.project_url = add_issues_tracker_id(issues_tracker['project_url'])
|
||||
self.issues_url = add_issues_tracker_id(issues_tracker['issues_url'])
|
||||
self.new_issue_url = add_issues_tracker_id(issues_tracker['new_issue_url'])
|
||||
self.properties = {
|
||||
title: issues_tracker['title'],
|
||||
project_url: add_issues_tracker_id(issues_tracker['project_url']),
|
||||
issues_url: add_issues_tracker_id(issues_tracker['issues_url']),
|
||||
new_issue_url: add_issues_tracker_id(issues_tracker['new_issue_url'])
|
||||
}
|
||||
else
|
||||
self.properties = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -94,8 +98,8 @@ class IssueTrackerService < Service
|
|||
|
||||
def enabled_in_gitlab_config
|
||||
Gitlab.config.issues_tracker &&
|
||||
Gitlab.config.issues_tracker.values.any? &&
|
||||
issues_tracker
|
||||
Gitlab.config.issues_tracker.values.any? &&
|
||||
issues_tracker
|
||||
end
|
||||
|
||||
def issues_tracker
|
||||
|
|
|
@ -23,7 +23,12 @@ class SlackService < Service
|
|||
boolean_accessor :notify_only_broken_builds
|
||||
validates :webhook, presence: true, if: :activated?
|
||||
|
||||
default_value_for :notify_only_broken_builds, true
|
||||
def initialize_properties
|
||||
if properties.nil?
|
||||
self.properties = {}
|
||||
self.notify_only_broken_builds = true
|
||||
end
|
||||
end
|
||||
|
||||
def title
|
||||
'Slack'
|
||||
|
|
|
@ -31,7 +31,6 @@ class Service < ActiveRecord::Base
|
|||
default_value_for :tag_push_events, true
|
||||
default_value_for :note_events, true
|
||||
default_value_for :build_events, true
|
||||
default_value_for :properties, {}
|
||||
|
||||
after_initialize :initialize_properties
|
||||
|
||||
|
|
Loading…
Reference in New Issue