diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2014-10-06 10:42:03 +0200 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2014-10-06 10:44:01 +0200 |
commit | e5998adc26f66b2b84cbcc28e98f3fc8f89b4696 (patch) | |
tree | cffd9d72df175ccf312eb01d28f2fc46c26f9c67 /app/models/project_services/slack_service.rb | |
parent | 216fb6ee07b80c2cb6cd78fdcb52c898fa2f41ea (diff) | |
download | gitlab-ce-e5998adc26f66b2b84cbcc28e98f3fc8f89b4696.tar.gz |
Accommodate new webhook url format.
Diffstat (limited to 'app/models/project_services/slack_service.rb')
-rw-r--r-- | app/models/project_services/slack_service.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb index 2174919346d..dfa1e9c9820 100644 --- a/app/models/project_services/slack_service.rb +++ b/app/models/project_services/slack_service.rb @@ -40,11 +40,13 @@ class SlackService < Service project_name: project_name )) - credentials = webhook.match(/(\w*).slack.com.*token=(\w*)/) - subdomain = credentials[1] - token = credentials[2] - notifier = Slack::Notifier.new(subdomain, token) - notifier.ping(message.pretext, attachments: message.attachments) + 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 end private |