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