Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project_services/slack_service.rb')
-rw-r--r--app/models/project_services/slack_service.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb
index 837002ef3c8..963f5440b6f 100644
--- a/app/models/project_services/slack_service.rb
+++ b/app/models/project_services/slack_service.rb
@@ -30,24 +30,20 @@ class SlackService < Service
def fields
[
- { type: 'text', name: 'webhook', placeholder: '' }
+ { type: 'text', name: 'webhook', placeholder: 'https://hooks.slack.com/services/...' }
]
end
def execute(push_data)
+ return unless webhook.present?
+
message = SlackMessage.new(push_data.merge(
project_url: project_url,
project_name: project_name
))
- credentials = webhook.match(/([\w-]*).slack.com.*services\/(.*)/)
-
- if credentials.present?
- subdomain = credentials[1]
- token = credentials[2].split("token=").last
- notifier = Slack::Notifier.new(subdomain, token)
- notifier.ping(message.pretext, attachments: message.attachments)
- end
+ notifier = Slack::Notifier.new(webhook)
+ notifier.ping(message.pretext, attachments: message.attachments)
end
private