Skip to content

Fix Error 500 resulting when loading network graph

Stan Hu requested to merge fix-network-graph-error-500 into master

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:

irb(main):019:0> notes[0]
  Note Load (10.3ms)  SELECT notes.commit_id, count(notes.id) as note_count FROM "notes" WHERE "notes"."project_id" = $1 AND (noteable_type = 'Commit') GROUP BY notes.commit_id  [["project_id", 13083]]
ActiveModel::MissingAttributeError: missing attribute: discussion_id

Closes #21119 (closed), #21128 (closed)

Merge request reports