Commit 8fc733e6 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '21002-slack-opened-merge-request-webhook-message-is-malformed' into 'master'

Add mention of Merge request in Slack message

See merge request gitlab-org/gitlab!33152
parents 8bb548e9 470496a2
...@@ -48,7 +48,7 @@ module ChatMessage ...@@ -48,7 +48,7 @@ module ChatMessage
end end
def merge_request_message def merge_request_message
"#{user_combined_name} #{state_or_action_text} #{merge_request_link} in #{project_link}" "#{user_combined_name} #{state_or_action_text} merge request #{merge_request_link} in #{project_link}"
end end
def merge_request_link def merge_request_link
......
---
title: Add explicit mention of Merge request in Slack message
merge_request: 33152
author:
type: changed
...@@ -36,7 +36,7 @@ RSpec.describe ChatMessage::MergeMessage do ...@@ -36,7 +36,7 @@ RSpec.describe ChatMessage::MergeMessage do
it 'returns a message regarding completed approval of merge requests' do it 'returns a message regarding completed approval of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) approved <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\ 'Test User (test.user) approved merge request <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\
'in <http://somewhere.com|project_name>') 'in <http://somewhere.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
...@@ -49,7 +49,7 @@ RSpec.describe ChatMessage::MergeMessage do ...@@ -49,7 +49,7 @@ RSpec.describe ChatMessage::MergeMessage do
it 'returns a message regarding revocation of completed approval of merge requests' do it 'returns a message regarding revocation of completed approval of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) unapproved <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\ 'Test User (test.user) unapproved merge request <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\
'in <http://somewhere.com|project_name>') 'in <http://somewhere.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
...@@ -62,7 +62,7 @@ RSpec.describe ChatMessage::MergeMessage do ...@@ -62,7 +62,7 @@ RSpec.describe ChatMessage::MergeMessage do
it 'returns a message regarding added approval of merge requests' do it 'returns a message regarding added approval of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) added their approval to <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\ 'Test User (test.user) added their approval to merge request <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\
'in <http://somewhere.com|project_name>') 'in <http://somewhere.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
...@@ -75,7 +75,7 @@ RSpec.describe ChatMessage::MergeMessage do ...@@ -75,7 +75,7 @@ RSpec.describe ChatMessage::MergeMessage do
it 'returns a message regarding revoking approval of merge requests' do it 'returns a message regarding revoking approval of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) removed their approval from <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\ 'Test User (test.user) removed their approval from merge request <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> '\
'in <http://somewhere.com|project_name>') 'in <http://somewhere.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
......
...@@ -52,7 +52,7 @@ describe ChatMessage::MergeMessage do ...@@ -52,7 +52,7 @@ describe ChatMessage::MergeMessage do
context 'open' do context 'open' do
it 'returns a message regarding opening of merge requests' do it 'returns a message regarding opening of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) opened <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> in <http://somewhere.com|project_name>') 'Test User (test.user) opened merge request <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> in <http://somewhere.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
end end
...@@ -63,7 +63,7 @@ describe ChatMessage::MergeMessage do ...@@ -63,7 +63,7 @@ describe ChatMessage::MergeMessage do
end end
it 'returns a message regarding closing of merge requests' do it 'returns a message regarding closing of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) closed <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> in <http://somewhere.com|project_name>') 'Test User (test.user) closed merge request <http://somewhere.com/-/merge_requests/100|!100 *Merge Request title*> in <http://somewhere.com|project_name>')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
end end
end end
...@@ -77,7 +77,7 @@ describe ChatMessage::MergeMessage do ...@@ -77,7 +77,7 @@ describe ChatMessage::MergeMessage do
context 'open' do context 'open' do
it 'returns a message regarding opening of merge requests' do it 'returns a message regarding opening of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) opened [!100 *Merge Request title*](http://somewhere.com/-/merge_requests/100) in [project_name](http://somewhere.com)') 'Test User (test.user) opened merge request [!100 *Merge Request title*](http://somewhere.com/-/merge_requests/100) in [project_name](http://somewhere.com)')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'Merge Request opened by Test User (test.user)', title: 'Merge Request opened by Test User (test.user)',
...@@ -95,7 +95,7 @@ describe ChatMessage::MergeMessage do ...@@ -95,7 +95,7 @@ describe ChatMessage::MergeMessage do
it 'returns a message regarding closing of merge requests' do it 'returns a message regarding closing of merge requests' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'Test User (test.user) closed [!100 *Merge Request title*](http://somewhere.com/-/merge_requests/100) in [project_name](http://somewhere.com)') 'Test User (test.user) closed merge request [!100 *Merge Request title*](http://somewhere.com/-/merge_requests/100) in [project_name](http://somewhere.com)')
expect(subject.attachments).to be_empty expect(subject.attachments).to be_empty
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'Merge Request closed by Test User (test.user)', title: 'Merge Request closed by Test User (test.user)',
......
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