summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-08-20 09:18:06 -0700
committerStan Hu <stanhu@gmail.com>2016-08-20 09:57:20 -0700
commit5cb488e8a1a10432c1c5a322b2d4748cb754277f (patch)
tree9f5a1e13e445d4d25af680eaea80fc16a67a73ce /app/models/note.rb
parent6a05f24621646790d1f5bccd0abc003b5386d0f0 (diff)
downloadgitlab-ce-fix-network-graph-error-500.tar.gz
Fix Error 500 resulting when loading network graphfix-network-graph-error-500
`discussion_id` may not be present when the SELECT call for notes does not include this attribute. Don't attempt to set the discussion ID unless the model contains the attribute. Closes #21119, #21128
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 3bbf5db0b70..f2656df028b 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -259,6 +259,8 @@ class Note < ActiveRecord::Base
def ensure_discussion_id
return unless self.persisted?
+ # Needed in case the SELECT statement doesn't ask for `discussion_id`
+ return unless self.has_attribute?(:discussion_id)
return if self.discussion_id
set_discussion_id