The Compare Changes expand button doesn't always change on outdated MR diff discussions
Summary
The Compare changes
expand button that is supposed to show up on a thread made on an outdated diff sometimes doesn't appear.
Steps to reproduce
So far, this seems to be the reproduction flow:
- Leave a thread on a diff.
- Commit a change affecting the line where you attached the thread on step 1.
- See the link is present.
- Commit another change on the same line.
- See the link is no longer present.
Example Project
gitlab-com/www-gitlab-com!103567 (comment 951772825)
What is the current bug behavior?
Expand button doesn't always show up.
What is the expected correct behavior?
Expand button should always show up.
Relevant logs and/or screenshots
Screenshot | Description |
---|---|
Button not appearing link | ![]() |
Button should appear link | ![]() |
Possible fixes
Could the bug be somewhere in these methods?
expose :outdated_line_change_path, if: -> (note, _) { note.show_outdated_changes? } do |note|
outdated_line_change_namespace_project_note_path(namespace_id: note.project.namespace, project_id: note.project, id: note)
end
in https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/serializers/note_entity.rb#L54
And
def show_outdated_changes?
return false unless for_merge_request?
return false unless system?
return false unless change_position&.line_range
change_position.line_range["end"] || change_position.line_range["start"]
end
in https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/note.rb#L626
Edited by André Luís