Commit a8c66765 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'Add-Issue-Link-to-Open-Message' into 'master'

Add Issue Link to "Issue opened by" Integration Chat Message

See merge request gitlab-org/gitlab!42785
parents 4a73592e 41517b4d
...@@ -41,15 +41,11 @@ module ChatMessage ...@@ -41,15 +41,11 @@ module ChatMessage
private private
def message def message
if opened_issue?
"[#{project_link}] Issue #{state} by #{user_combined_name}"
else
"[#{project_link}] Issue #{issue_link} #{state} by #{user_combined_name}" "[#{project_link}] Issue #{issue_link} #{state} by #{user_combined_name}"
end end
end
def opened_issue? def opened_issue?
action == "open" action == 'open'
end end
def description_message def description_message
...@@ -57,7 +53,7 @@ module ChatMessage ...@@ -57,7 +53,7 @@ module ChatMessage
title: issue_title, title: issue_title,
title_link: issue_url, title_link: issue_url,
text: format(description), text: format(description),
color: "#C95823" color: '#C95823'
}] }]
end end
......
---
title: Add Issue Link to "Issue opened by" Integration Chat Message
merge_request: 42785
author: Kev @KevSlashNull
type: changed
...@@ -44,7 +44,7 @@ RSpec.describe ChatMessage::IssueMessage do ...@@ -44,7 +44,7 @@ RSpec.describe ChatMessage::IssueMessage do
context 'open' do context 'open' do
it 'returns a message regarding opening of issues' do it 'returns a message regarding opening of issues' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'[<http://somewhere.com|project_name>] Issue opened by Test User (test.user)') '[<http://somewhere.com|project_name>] Issue <http://url.com|#100 Issue title> opened by Test User (test.user)')
expect(subject.attachments).to eq([ expect(subject.attachments).to eq([
{ {
title: "#100 Issue title", title: "#100 Issue title",
...@@ -91,7 +91,7 @@ RSpec.describe ChatMessage::IssueMessage do ...@@ -91,7 +91,7 @@ RSpec.describe ChatMessage::IssueMessage do
context 'open' do context 'open' do
it 'returns a message regarding opening of issues' do it 'returns a message regarding opening of issues' do
expect(subject.pretext).to eq( expect(subject.pretext).to eq(
'[[project_name](http://somewhere.com)] Issue opened by Test User (test.user)') '[[project_name](http://somewhere.com)] Issue [#100 Issue title](http://url.com) opened by Test User (test.user)')
expect(subject.attachments).to eq('issue description') expect(subject.attachments).to eq('issue description')
expect(subject.activity).to eq({ expect(subject.activity).to eq({
title: 'Issue opened by Test User (test.user)', title: 'Issue opened 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