Commit 7f5fe388 authored by Justin Ho's avatar Justin Ho

Use renamed slack-messenger gem

Due to a bug in the original gem, we need to fork
and rename to continue using it.
parent b37b89f5
......@@ -237,7 +237,7 @@ gem 'atlassian-jwt', '~> 0.2.0'
gem 'flowdock', '~> 0.7'
# Slack integration
gem 'slack-notifier', '~> 2.3.2'
gem 'slack-messenger', '~> 2.3.3'
# Hangouts Chat integration
gem 'hangouts-chat', '~> 0.0.5'
......
......@@ -1021,7 +1021,7 @@ GEM
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sixarm_ruby_unaccent (1.2.0)
slack-notifier (2.3.2)
slack-messenger (2.3.3)
snowplow-tracker (0.6.1)
contracts (~> 0.7, <= 0.11)
spring (2.0.2)
......@@ -1376,7 +1376,7 @@ DEPENDENCIES
sidekiq-cron (~> 1.0)
simple_po_parser (~> 1.1.2)
simplecov (~> 0.16.1)
slack-notifier (~> 2.3.2)
slack-messenger (~> 2.3.3)
snowplow-tracker (~> 0.6.1)
spring (~> 2.0.0)
spring-commands-rspec (~> 1.0.4)
......
# frozen_string_literal: true
require 'slack-notifier'
require 'slack-messenger'
module ChatMessage
class BaseMessage
......@@ -59,7 +59,7 @@ module ChatMessage
end
def format(string)
Slack::Notifier::Util::LinkFormatter.format(format_relative_links(string))
Slack::Messenger::Util::LinkFormatter.format(format_relative_links(string))
end
def format_relative_links(string)
......
# frozen_string_literal: true
require 'slack-notifier'
require 'slack-messenger'
module ChatMessage
class PipelineMessage < BaseMessage
......@@ -98,7 +98,7 @@ module ChatMessage
def failed_stages_field
{
title: s_("ChatMessage|Failed stage").pluralize(failed_stages.length),
value: Slack::Notifier::Util::LinkFormatter.format(failed_stages_links),
value: Slack::Messenger::Util::LinkFormatter.format(failed_stages_links),
short: true
}
end
......@@ -106,7 +106,7 @@ module ChatMessage
def failed_jobs_field
{
title: s_("ChatMessage|Failed job").pluralize(failed_jobs.length),
value: Slack::Notifier::Util::LinkFormatter.format(failed_jobs_links),
value: Slack::Messenger::Util::LinkFormatter.format(failed_jobs_links),
short: true
}
end
......@@ -123,12 +123,12 @@ module ChatMessage
fields = [
{
title: ref_type == "tag" ? s_("ChatMessage|Tag") : s_("ChatMessage|Branch"),
value: Slack::Notifier::Util::LinkFormatter.format(ref_link),
value: Slack::Messenger::Util::LinkFormatter.format(ref_link),
short: true
},
{
title: s_("ChatMessage|Commit"),
value: Slack::Notifier::Util::LinkFormatter.format(commit_link),
value: Slack::Messenger::Util::LinkFormatter.format(commit_link),
short: true
}
]
......
......@@ -48,7 +48,7 @@ module ChatMessage
end
def format(string)
Slack::Notifier::Util::LinkFormatter.format(string)
Slack::Messenger::Util::LinkFormatter.format(string)
end
def commit_messages
......
......@@ -37,7 +37,7 @@ class SlackService < ChatNotificationService
def notify(message, opts)
# See https://github.com/stevenosloan/slack-notifier#custom-http-client
notifier = Slack::Notifier.new(webhook, opts.merge(http_client: HTTPClient))
notifier = Slack::Messenger.new(webhook, opts.merge(http_client: HTTPClient))
notifier.ping(
message.pretext,
......
......@@ -29,6 +29,6 @@ class SlackSlashCommandsService < SlashCommandsService
private
def format(text)
Slack::Notifier::Util::LinkFormatter.format(text) if text
Slack::Messenger::Util::LinkFormatter.format(text) if text
end
end
......@@ -63,7 +63,7 @@ module Gitlab
# Convert Markdown to slacks format
def format(string)
Slack::Notifier::Util::LinkFormatter.format(string)
Slack::Messenger::Util::LinkFormatter.format(string)
end
def resource_url
......
......@@ -151,14 +151,14 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it 'uses the username as an option for slack when configured' do
allow(chat_service).to receive(:username).and_return(username)
expect(Slack::Notifier).to execute_with_options(username: username)
expect(Slack::Messenger).to execute_with_options(username: username)
chat_service.execute(data)
end
it 'uses the channel as an option when it is configured' do
allow(chat_service).to receive(:channel).and_return(channel)
expect(Slack::Notifier).to execute_with_options(channel: [channel])
expect(Slack::Messenger).to execute_with_options(channel: [channel])
chat_service.execute(data)
end
......@@ -166,7 +166,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it "uses the right channel for push event" do
chat_service.update(push_channel: "random")
expect(Slack::Notifier).to execute_with_options(channel: ['random'])
expect(Slack::Messenger).to execute_with_options(channel: ['random'])
chat_service.execute(data)
end
......@@ -174,7 +174,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it "uses the right channel for merge request event" do
chat_service.update(merge_request_channel: "random")
expect(Slack::Notifier).to execute_with_options(channel: ['random'])
expect(Slack::Messenger).to execute_with_options(channel: ['random'])
chat_service.execute(@merge_sample_data)
end
......@@ -182,7 +182,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it "uses the right channel for issue event" do
chat_service.update(issue_channel: "random")
expect(Slack::Notifier).to execute_with_options(channel: ['random'])
expect(Slack::Messenger).to execute_with_options(channel: ['random'])
chat_service.execute(@issues_sample_data)
end
......@@ -193,7 +193,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it "uses confidential issue channel" do
chat_service.update(confidential_issue_channel: 'confidential')
expect(Slack::Notifier).to execute_with_options(channel: ['confidential'])
expect(Slack::Messenger).to execute_with_options(channel: ['confidential'])
chat_service.execute(@issues_sample_data)
end
......@@ -201,7 +201,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it 'falls back to issue channel' do
chat_service.update(issue_channel: 'fallback_channel')
expect(Slack::Notifier).to execute_with_options(channel: ['fallback_channel'])
expect(Slack::Messenger).to execute_with_options(channel: ['fallback_channel'])
chat_service.execute(@issues_sample_data)
end
......@@ -210,7 +210,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
it "uses the right channel for wiki event" do
chat_service.update(wiki_page_channel: "random")
expect(Slack::Notifier).to execute_with_options(channel: ['random'])
expect(Slack::Messenger).to execute_with_options(channel: ['random'])
chat_service.execute(@wiki_page_sample_data)
end
......@@ -225,7 +225,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
note_data = Gitlab::DataBuilder::Note.build(issue_note, user)
expect(Slack::Notifier).to execute_with_options(channel: ['random'])
expect(Slack::Messenger).to execute_with_options(channel: ['random'])
chat_service.execute(note_data)
end
......@@ -240,7 +240,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
note_data = Gitlab::DataBuilder::Note.build(issue_note, user)
expect(Slack::Notifier).to execute_with_options(channel: ['confidential'])
expect(Slack::Messenger).to execute_with_options(channel: ['confidential'])
chat_service.execute(note_data)
end
......@@ -250,7 +250,7 @@ RSpec.shared_examples 'slack or mattermost notifications' do |service_name|
note_data = Gitlab::DataBuilder::Note.build(issue_note, user)
expect(Slack::Notifier).to execute_with_options(channel: ['fallback_channel'])
expect(Slack::Messenger).to execute_with_options(channel: ['fallback_channel'])
chat_service.execute(note_data)
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