summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-09-20 11:47:08 +0100
committerNick Thomas <nick@gitlab.com>2018-09-20 11:52:14 +0100
commit49c07a4139701cef14e9f1335c819f618717bf95 (patch)
tree72776ba5437f76831771b1792c869a3c1b6af285
parent8c2192943a5efc4d0a28c67b04bf9b979def66a1 (diff)
downloadgitlab-ce-49c07a4139701cef14e9f1335c819f618717bf95.tar.gz
Fix activity titles for MRs in chat notification services
-rw-r--r--app/models/project_services/chat_message/merge_message.rb2
-rw-r--r--changelogs/unreleased/fix-chat-notification-service-for-ee.yml5
-rw-r--r--spec/models/project_services/chat_message/merge_message_spec.rb17
3 files changed, 23 insertions, 1 deletions
diff --git a/app/models/project_services/chat_message/merge_message.rb b/app/models/project_services/chat_message/merge_message.rb
index cc88d57faf8..6b7a35aaa75 100644
--- a/app/models/project_services/chat_message/merge_message.rb
+++ b/app/models/project_services/chat_message/merge_message.rb
@@ -26,7 +26,7 @@ module ChatMessage
def activity
{
- title: "Merge Request #{state} by #{user_combined_name}",
+ title: "Merge Request #{state_or_action_text} by #{user_combined_name}",
subtitle: "in #{project_link}",
text: merge_request_link,
image: user_avatar
diff --git a/changelogs/unreleased/fix-chat-notification-service-for-ee.yml b/changelogs/unreleased/fix-chat-notification-service-for-ee.yml
new file mode 100644
index 00000000000..b69d08b95db
--- /dev/null
+++ b/changelogs/unreleased/fix-chat-notification-service-for-ee.yml
@@ -0,0 +1,5 @@
+---
+title: Fix activity titles for MRs in chat notification services
+merge_request: 21834
+author:
+type: fixed
diff --git a/spec/models/project_services/chat_message/merge_message_spec.rb b/spec/models/project_services/chat_message/merge_message_spec.rb
index 96496295825..7997b5bb6b9 100644
--- a/spec/models/project_services/chat_message/merge_message_spec.rb
+++ b/spec/models/project_services/chat_message/merge_message_spec.rb
@@ -27,6 +27,23 @@ describe ChatMessage::MergeMessage do
}
end
+ # Integration point in EE
+ context 'when state is overridden' do
+ it 'respects the overridden state' do
+ allow(subject).to receive(:state_or_action_text) { 'devoured' }
+
+ aggregate_failures do
+ expect(subject.summary).not_to include('opened')
+ expect(subject.summary).to include('devoured')
+
+ activity_title = subject.activity[:title]
+
+ expect(activity_title).not_to include('opened')
+ expect(activity_title).to include('devoured')
+ end
+ end
+ end
+
context 'without markdown' do
let(:color) { '#345' }