Fix old user notes not loading
What does this MR do and why?
Makes old user notes load again.
In some older issues, comments are not loading at all. Right now, all comments that contain a system note at the beginning are not loaded leading to empty issues
Example: gitlab-foss#3299 (closed)
Closes #581732 (closed)
References
Screenshots or screen recordings
How to set up and validate locally
On gitlab.com
- Visit gitlab-foss#3299 (closed) and notice that the comments are not loading
- Open the developer console, network tab
- Reload the page and search for "graphql" in the network tab
- Find the payload by operationName:
workItemNotesByIidand go to theResponsetab - Notice how comments are actually loaded, but the first note is a system note
In the GDK
Let's create a broken issue
- Open the rails console
- Paste this in
project = Project.find_by_full_path('flightjs/Flight')
issue = project.issues.create!(
title: 'Test issue with system note thread',
description: 'Testing'
)
user = User.first
system_note = Note.create!(
noteable: issue,
project: project,
author: user,
note: 'changed milestone to Test',
system: true,
system_note_metadata: SystemNoteMetadata.new(action: 'milestone')
)
discussion_id = issue.notes.last.discussion_id
Note.create!(
noteable: issue,
project: project,
author: User.first,
note: 'First user comment in system note thread',
discussion_id: discussion_id
)
Note.create!(
noteable: issue,
project: project,
author: User.first,
note: 'Second user comment in system note thread',
discussion_id: discussion_id
)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Please help me to add tests here. Not sure how to do that
Edited by Max Wittig

