Commit f97a383f authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '198009-ms-teams-notification-message-improved' into 'master'

Improves message UI on Microsoft Teams notification integration

Closes #198009

See merge request gitlab-org/gitlab!23385
parents b3bb149e f13098af
---
title: Improve message UI on Microsoft Teams notification
merge_request: 23385
author: Takuya Noguchi
type: fixed
......@@ -36,10 +36,7 @@ module MicrosoftTeams
attachments = options[:attachments]
unless attachments.blank?
result['sections'] << {
'title' => 'Details',
'facts' => [{ 'name' => 'Attachments', 'value' => attachments }]
}
result['sections'] << { text: attachments }
end
result.to_json
......
......@@ -17,7 +17,7 @@ describe MicrosoftTeams::Notifier do
text: '[#1 Awesome issue](http://localhost/namespace2/gitlabhq/issues/1)',
image: 'http://someimage.com'
},
attachments: 'please fix'
attachments: "[GitLab](https://gitlab.com)\n\n- _Ruby_\n- **Go**\n"
}
end
......@@ -31,13 +31,7 @@ describe MicrosoftTeams::Notifier do
'activityImage' => 'http://someimage.com'
},
{
'title' => 'Details',
'facts' => [
{
'name' => 'Attachments',
'value' => 'please fix'
}
]
text: "[GitLab](https://gitlab.com)\n\n- _Ruby_\n- **Go**\n"
}
],
'title' => 'JohnDoe4/project2',
......@@ -54,4 +48,14 @@ describe MicrosoftTeams::Notifier do
expect(subject.ping(options)).to be true
end
end
describe '#body' do
it 'returns Markdown-based body when HTML was passed' do
expect(subject.send(:body, options)).to eq(body.to_json)
end
it 'fails when empty Hash was passed' do
expect { subject.send(:body, {}) }.to raise_error(ArgumentError)
end
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