Refresh commit list lock labels after lock changes

What does this MR do and why?

Part of #545279 (closed). Stacked on !249473 (merged) (targets its branch); marked as related work in the feature breakdown below.

Task MR
Add createdAt to PathLock GraphQL type !249031 (merged)
Add component !246285 (merged)
Use component to lock file !246286 (merged)
Use component to lock directories !249473 (merged)
Refresh commit list lock labels this MR ⬅️ we're here
Show upstream lock state on files inside locked directories !250523 (merged)
Update documentation !250296 (merged)

The lock labels in the commit list ("Locked by <user>") come from the logs_tree REST endpoint and are cached in the commits service. The legacy directory lock button kept them accurate with a full page reload after every lock change. The new lock button (added in the MRs above) updates through Apollo instead, so the REST-cached labels went stale until the next navigation.

This MR:

  • Emits a lock:updated event on the repository event hub after a successful lock/unlock mutation in the lock button.
  • Adds reloadCommits to the commits service, which refetches every already-loaded commit batch.
  • Subscribes tree_content.vue to the event and reloads the commit data, so lock labels refresh in place without a page reload.

References

Screenshots or screen recordings

How to set up and validate locally

  1. Enable the feature flag:

    Feature.enable(:repository_lock_information)
  2. As a maintainer, open a directory in a project repository (/<group>/<project>/-/tree/master/<some-dir>) on a Premium/Ultimate GDK.

  3. Lock the directory using the Lock button → after the "The directory is locked." toast, the Lock column entries for the directory's rows update in place (no page reload).

  4. Unlock the directory → the lock labels clear, again without a reload.

  5. Scroll down first so several commit batches load, then lock → all loaded rows refresh, not only the first batch.

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 #545279 (closed)

Edited by Chaoyue Zhao

Merge request reports

Loading
Loading