[go: up one dir, main page]

Support hiding discussions on commit diffs

What does this MR do and why?

This MR adds the ability to hide and show discussions (comments) on individual files in commit diff views, improving the user experience when reviewing large commits with many discussions.

What it does:

  • Adds a "Hide comments on this file" / "Show comments on this file" toggle button to the file options dropdown in commit diffs
  • Implements a hidden property for discussions that prevents them from rendering when set to true
  • Automatically shows all discussions when creating a new discussion on a file (to ensure context visibility)
  • Extends the diff discussions store with toggleFileDiscussions action and findDiscussionsForFile getter

References

See #580294 (comment 2931972069) for implementation plan.

Rapid Diffs Initiative

This MR is part of the Reusable Rapid Diffs (was: New diffs) (gitlab-org#11559), specifically Rapid Diffs for the commits (`/-/commits/<SHA>`... (gitlab-org#17804). This initiative aims to improve the performance and user experience of GitLab's diff viewing capabilities.

High level technical details

  • Since hiding/showing comments meant to be transient, this is being implemented 100% client side.
  • This leverages the existing adapter system. Each adapter under rapid diffs is meant to be a self-contained module that defines event handler and allows feature-specific logic without coupling to the base diff rendering
  • Specifically, this adds commit-specific option menu adapter which is an extension of the existing optionsMenuAdapter .
  • Hiding and showing discussions is then handled via pinia store using state hidden), getter findDiscussionsForFile) and action toggleFileDiscussions)

Screenshots or screen recordings

CleanShot 2025-12-04 at 19.12.37.mp4

How to set up and validate locally

  • Enable rapid_diffs_on_commit_show FF
  • Go to any commits with comments, ideally a commit with multiple files, some with comments, some don't.
  • Add ?rapid_diffs=true to the url. This would allow you to see rapid diffs. You can confirm you're in rapid diffs if you see a three dot menu in the file header.
  • Click on the file header
    • For files with discussions, "Hide comments on this file" should show
    • For files with no discussions, "Hide comments on this file" should not show
  • Click "Hide comments on this file", comments should hide and button text changes into "Show comments on this file"

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.

Related to #580294

Edited by Chaoyue Zhao

Merge request reports

Loading