summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-03-29 16:30:55 +0000
committerRobert Speicher <robert@gitlab.com>2016-03-29 16:30:55 +0000
commitb1f924c165525f24848df3a7a4119b74fefc6e21 (patch)
treed7b8cd21dae0ce335ae4e3a34cfa4ea50c226530
parentc19195f4858cee08918953e838ed2ae423ac574b (diff)
parent2fa20f2d4f9dd6b5fd4c55018da243d9a8d0548f (diff)
downloadgitlab-ce-b1f924c165525f24848df3a7a4119b74fefc6e21.tar.gz
Merge branch 'handle-nil-description-slack-message' into 'master'
Handle nil descriptions in Slack issue messages Closes #14676 See merge request !3420
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/project_services/slack_service/issue_message.rb2
-rw-r--r--spec/models/project_services/slack_service/issue_message_spec.rb10
3 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3289dc99ef9..995b493c8bc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ v 8.7.0 (unreleased)
- Allow back dating on issues when created through the API
- Fix avatar stretching by providing a cropping feature
- Add links to CI setup documentation from project settings and builds pages
+ - Handle nil descriptions in Slack issue messages (Stan Hu)
- Implement 'Groups View' as an option for dashboard preferences !3379 (Elias W.)
- Implement 'TODOs View' as an option for dashboard preferences !3379 (Elias W.)
diff --git a/app/models/project_services/slack_service/issue_message.rb b/app/models/project_services/slack_service/issue_message.rb
index 5af24a80609..438ff33fdff 100644
--- a/app/models/project_services/slack_service/issue_message.rb
+++ b/app/models/project_services/slack_service/issue_message.rb
@@ -22,7 +22,7 @@ class SlackService
@issue_url = obj_attr[:url]
@action = obj_attr[:action]
@state = obj_attr[:state]
- @description = obj_attr[:description]
+ @description = obj_attr[:description] || ''
end
def attachments
diff --git a/spec/models/project_services/slack_service/issue_message_spec.rb b/spec/models/project_services/slack_service/issue_message_spec.rb
index 97e6f03e308..f648cbe2dee 100644
--- a/spec/models/project_services/slack_service/issue_message_spec.rb
+++ b/spec/models/project_services/slack_service/issue_message_spec.rb
@@ -27,6 +27,16 @@ describe SlackService::IssueMessage, models: true do
let(:color) { '#345' }
+ context '#initialize' do
+ before do
+ args[:object_attributes][:description] = nil
+ end
+
+ it 'returns a non-null description' do
+ expect(subject.description).to eq('')
+ end
+ end
+
context 'open' do
it 'returns a message regarding opening of issues' do
expect(subject.pretext).to eq(