Commit 399eb9f1 authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Set branches_to_be_notified only if not already set

Signed-off-by: default avatarBalasankar "Balu" C <balasankar@gitlab.com>
parent 7f4638a9
...@@ -29,7 +29,7 @@ class ChatNotificationService < Service ...@@ -29,7 +29,7 @@ class ChatNotificationService < Service
self.properties = {} self.properties = {}
self.notify_only_broken_pipelines = true self.notify_only_broken_pipelines = true
self.branches_to_be_notified = "default" self.branches_to_be_notified = "default"
elsif !self.notify_only_default_branch.nil? && self.branches_to_be_notified.nil? elsif !self.notify_only_default_branch.nil?
# In older versions, there was only a boolean property named # In older versions, there was only a boolean property named
# `notify_only_default_branch`. Now we have a string property named # `notify_only_default_branch`. Now we have a string property named
# `branches_to_be_notified`. Instead of doing a background migration, we # `branches_to_be_notified`. Instead of doing a background migration, we
...@@ -37,7 +37,7 @@ class ChatNotificationService < Service ...@@ -37,7 +37,7 @@ class ChatNotificationService < Service
# users hasn't specified one already. When users edit the service and # users hasn't specified one already. When users edit the service and
# selects a value for this new property, it will override everything. # selects a value for this new property, it will override everything.
self.branches_to_be_notified = notify_only_default_branch? ? "default" : "all" self.branches_to_be_notified ||= notify_only_default_branch? ? "default" : "all"
end end
end end
......
...@@ -12,7 +12,7 @@ class PipelinesEmailService < Service ...@@ -12,7 +12,7 @@ class PipelinesEmailService < Service
self.properties = {} self.properties = {}
self.notify_only_broken_pipelines = true self.notify_only_broken_pipelines = true
self.branches_to_be_notified = "default" self.branches_to_be_notified = "default"
elsif !self.notify_only_default_branch.nil? && self.branches_to_be_notified.nil? elsif !self.notify_only_default_branch.nil?
# In older versions, there was only a boolean property named # In older versions, there was only a boolean property named
# `notify_only_default_branch`. Now we have a string property named # `notify_only_default_branch`. Now we have a string property named
# `branches_to_be_notified`. Instead of doing a background migration, we # `branches_to_be_notified`. Instead of doing a background migration, we
...@@ -20,7 +20,7 @@ class PipelinesEmailService < Service ...@@ -20,7 +20,7 @@ class PipelinesEmailService < Service
# users hasn't specified one already. When users edit the service and # users hasn't specified one already. When users edit the service and
# selects a value for this new property, it will override everything. # selects a value for this new property, it will override everything.
self.branches_to_be_notified = notify_only_default_branch? ? "default" : "all" self.branches_to_be_notified ||= notify_only_default_branch? ? "default" : "all"
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment