diff options
Diffstat (limited to 'app/models/project_services/slack_service.rb')
-rw-r--r-- | app/models/project_services/slack_service.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb index 6d567bb1383..79245e84238 100644 --- a/app/models/project_services/slack_service.rb +++ b/app/models/project_services/slack_service.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class SlackService < ChatNotificationService + prop_accessor EVENT_CHANNEL['alert'] + def title 'Slack notifications' end @@ -21,13 +23,25 @@ class SlackService < ChatNotificationService 'https://hooks.slack.com/services/…' end + def supported_events + additional = [] + additional << 'alert' + + super + additional + end + + def get_message(object_kind, data) + return ChatMessage::AlertMessage.new(data) if object_kind == 'alert' + + super + end + module Notifier private def notify(message, opts) # See https://gitlab.com/gitlab-org/slack-notifier/#custom-http-client notifier = Slack::Messenger.new(webhook, opts.merge(http_client: HTTPClient)) - notifier.ping( message.pretext, attachments: message.attachments, |