summaryrefslogtreecommitdiff
path: root/app/models/project_services/chat_notification_service.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-12-22 16:12:35 -0200
committerFelipe Artur <felipefac@gmail.com>2016-12-22 16:16:10 -0200
commit6dc3efdd9896156b5b08c735f1639437ff874fc0 (patch)
tree84439f5c67e3b10a51e89461e24e6aabc8628779 /app/models/project_services/chat_notification_service.rb
parent47550d092f0a6cbedc58752d1a220fe519b8ea01 (diff)
downloadgitlab-ce-6dc3efdd9896156b5b08c735f1639437ff874fc0.tar.gz
Do not override incoming webhook channel for mattermost and slack
Diffstat (limited to 'app/models/project_services/chat_notification_service.rb')
-rw-r--r--app/models/project_services/chat_notification_service.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/project_services/chat_notification_service.rb b/app/models/project_services/chat_notification_service.rb
index b0556987721..475344d80ce 100644
--- a/app/models/project_services/chat_notification_service.rb
+++ b/app/models/project_services/chat_notification_service.rb
@@ -49,10 +49,12 @@ class ChatNotificationService < Service
return false unless message
- opt = {}
+ channel_name = get_channel_field(object_kind).presence || channel
- opt[:channel] = get_channel_field(object_kind).presence || channel || default_channel
+ opt = {}
+ opt[:channel] = channel_name if channel_name
opt[:username] = username if username
+
notifier = Slack::Notifier.new(webhook, opt)
notifier.ping(message.pretext, attachments: message.attachments, fallback: message.fallback)
@@ -71,7 +73,7 @@ class ChatNotificationService < Service
fields.reject { |field| field[:name].end_with?('channel') }
end
- def default_channel
+ def default_channel_placeholder
raise NotImplementedError
end
@@ -103,7 +105,7 @@ class ChatNotificationService < Service
def build_event_channels
supported_events.reduce([]) do |channels, event|
- channels << { type: 'text', name: event_channel_name(event), placeholder: default_channel }
+ channels << { type: 'text', name: event_channel_name(event), placeholder: default_channel_placeholder }
end
end