summaryrefslogtreecommitdiff
path: root/app/models/integrations/chat_message
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/integrations/chat_message')
-rw-r--r--app/models/integrations/chat_message/base_message.rb2
-rw-r--r--app/models/integrations/chat_message/pipeline_message.rb8
-rw-r--r--app/models/integrations/chat_message/push_message.rb2
-rw-r--r--app/models/integrations/chat_message/wiki_page_message.rb12
4 files changed, 15 insertions, 9 deletions
diff --git a/app/models/integrations/chat_message/base_message.rb b/app/models/integrations/chat_message/base_message.rb
index 2f70384d3b9..afe3ffc45a0 100644
--- a/app/models/integrations/chat_message/base_message.rb
+++ b/app/models/integrations/chat_message/base_message.rb
@@ -58,7 +58,7 @@ module Integrations
end
def format(string)
- Slack::Messenger::Util::LinkFormatter.format(format_relative_links(string))
+ ::Slack::Messenger::Util::LinkFormatter.format(format_relative_links(string))
end
def format_relative_links(string)
diff --git a/app/models/integrations/chat_message/pipeline_message.rb b/app/models/integrations/chat_message/pipeline_message.rb
index a0f6f582e4c..a3f68d34035 100644
--- a/app/models/integrations/chat_message/pipeline_message.rb
+++ b/app/models/integrations/chat_message/pipeline_message.rb
@@ -105,7 +105,7 @@ module Integrations
def failed_stages_field
{
title: s_("ChatMessage|Failed stage").pluralize(failed_stages.length),
- value: Slack::Messenger::Util::LinkFormatter.format(failed_stages_links),
+ value: ::Slack::Messenger::Util::LinkFormatter.format(failed_stages_links),
short: true
}
end
@@ -113,7 +113,7 @@ module Integrations
def failed_jobs_field
{
title: s_("ChatMessage|Failed job").pluralize(failed_jobs.length),
- value: Slack::Messenger::Util::LinkFormatter.format(failed_jobs_links),
+ value: ::Slack::Messenger::Util::LinkFormatter.format(failed_jobs_links),
short: true
}
end
@@ -130,12 +130,12 @@ module Integrations
fields = [
{
title: ref_type == "tag" ? s_("ChatMessage|Tag") : s_("ChatMessage|Branch"),
- value: Slack::Messenger::Util::LinkFormatter.format(ref_link),
+ value: ::Slack::Messenger::Util::LinkFormatter.format(ref_link),
short: true
},
{
title: s_("ChatMessage|Commit"),
- value: Slack::Messenger::Util::LinkFormatter.format(commit_link),
+ value: ::Slack::Messenger::Util::LinkFormatter.format(commit_link),
short: true
}
]
diff --git a/app/models/integrations/chat_message/push_message.rb b/app/models/integrations/chat_message/push_message.rb
index 0952986e923..fabd214633b 100644
--- a/app/models/integrations/chat_message/push_message.rb
+++ b/app/models/integrations/chat_message/push_message.rb
@@ -49,7 +49,7 @@ module Integrations
end
def format(string)
- Slack::Messenger::Util::LinkFormatter.format(string)
+ ::Slack::Messenger::Util::LinkFormatter.format(string)
end
def commit_messages
diff --git a/app/models/integrations/chat_message/wiki_page_message.rb b/app/models/integrations/chat_message/wiki_page_message.rb
index 9b5275b8c03..00f0f911b0e 100644
--- a/app/models/integrations/chat_message/wiki_page_message.rb
+++ b/app/models/integrations/chat_message/wiki_page_message.rb
@@ -7,6 +7,7 @@ module Integrations
attr_reader :wiki_page_url
attr_reader :action
attr_reader :description
+ attr_reader :diff_url
def initialize(params)
super
@@ -16,6 +17,7 @@ module Integrations
@title = obj_attr[:title]
@wiki_page_url = obj_attr[:url]
@description = obj_attr[:message]
+ @diff_url = obj_attr[:diff_url]
@action =
case obj_attr[:action]
@@ -44,19 +46,23 @@ module Integrations
private
def message
- "#{user_combined_name} #{action} #{wiki_page_link} in #{project_link}: *#{title}*"
+ "#{user_combined_name} #{action} #{wiki_page_link} (#{diff_link}) in #{project_link}: *#{title}*"
end
def description_message
[{ text: format(@description), color: attachment_color }]
end
+ def diff_link
+ link('Compare changes', diff_url)
+ end
+
def project_link
- "[#{project_name}](#{project_url})"
+ link(project_name, project_url)
end
def wiki_page_link
- "[wiki page](#{wiki_page_url})"
+ link('wiki page', wiki_page_url)
end
end
end