Fix hide comments doing nothing on repositioned diffs

Summary

In Rapid Diffs, clicking the collapse arrow to hide an inline comment could silently do nothing, leaving the thread expanded. It affected comments that no longer sit at the line they were originally posted on, because the merge request received new commits after the comment was written. Hiding and showing comments now works by discussion identity instead of by line lookup, matching how they are already rendered — a line number is a coordinate inside one particular diff, not an identity, which is what let the two sides disagree. The same fix restores auto-collapse when a thread's last unresolved note is resolved.

Supersedes !255694 (closed), which fixed the same bug by making the line lookup diff-refs aware and is now closed.

Reproduction steps

  1. Open a merge request that received new commits after a comment was posted (on gitlab.com most comments on an updated merge request qualify).
  2. Switch the Changes tab to Rapid Diffs.
  3. Click the collapse arrow next to an inline comment.
  4. Before this change the thread stays expanded; after it, it collapses.

🤖 Generated with Claude Code

Edited by Stanislav Lashmanov

Merge request reports

Loading
Loading