Use lock button component for directory locks

What does this MR do and why?

Part of #545279 (closed), see 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) ⬅️ we're here
Refresh commit list lock labels !250294 (merged)
Update documentation !250296 (merged)

Wires the lock button component (added in !246285 (merged)) into the tree header, replacing the legacy directory Lock/Unlock button group when the repository_lock_information feature flag is enabled.

Behavior:

  • Exact locks (the directory itself is locked): the Locked disclosure shows the lock author, lock time, and an Unlock directory action (permission permitting).
  • Upstream locks (an ancestor directory is locked): the directory also shows as Locked; the disclosure explains in a warning alert that the parent directory is locked, and the footer offers a View lock button navigating to the locked ancestor instead of the unlock action.
  • Downstream locks (a file or directory inside is locked): same treatment — the alert names the locked path inside the directory, and the footer's View lock button navigates to it.
  • Unlike the legacy button, the lock button updates through an Apollo refetch instead of a full page reload, so tree row lock icons refresh on the next navigation rather than immediately.
  • Feature flag off: the legacy directory Lock/Unlock button group is unchanged.

Data plumbing:

  • Removes the heading lock icon (header_lock_icon.vue) and its lock-state plumbing from header_area.vue (the directoryLocked/lockUser state and locked-directory event listener), since both the file and directory lock buttons now surface lock state themselves. The legacy directory button no longer emits locked-directory.

References

Screenshots or screen recordings

FF on FF off
Upstream lock CleanShot 2026-08-14 at 17.52.17.png CleanShot 2026-08-14 at 17.53.32.png
Downstream lock CleanShot 2026-08-14 at 17.54.52.png CleanShot 2026-08-14 at 17.54.23.png
User cannot unlock CleanShot 2026-08-14 at 17.57.20.png CleanShot 2026-08-14 at 17.58.38.png
Exact lock, user is the locker and can unlock CleanShot 2026-08-11 at 14.40.27@2x.png CleanShot 2026-08-11 at 14.40.05@2x.png
No lock CleanShot 2026-08-14 at 17.55.26.png CleanShot 2026-08-11 at 14.41.33@2x.png

How to set up and validate locally

  • Enable repository_lock_information
    • As a maintainer, open any directory in a project repository (/<group>/<project>/-/tree/master/<some-dir>).
    • Lock flow: a Lock button (text only, no icon) appears in the tree controls → click it → confirm modal ("Lock directory?" / "Are you sure you want to lock the "<dir>" directory?") → confirm → "The directory is locked." toast, and the button becomes a Locked disclosure with your avatar (no page reload).
    • Disclosure: header shows "Locked by <name> · <time ago>", user card links to the profile, Unlock directory button in the footer.
    • Unlock flow: click Unlock directory → confirm modal ("Are you sure you want to unlock the "<dir>" directory?") → "The directory is unlocked." toast; the button reverts to Lock.
    • Upstream lock: lock directory a, then navigate into a child directory a/b → shows Locked; the disclosure has a warning alert ("The parent directory "a" is locked. To unlock this directory, unlock "a".") and a View lock footer button navigating to a.
    • Downstream lock: lock a file or directory inside a (but not a itself), then visit a → shows Locked; the alert reads "You cannot lock this directory because "<path>" inside it is locked.", and the footer's View lock button navigates to the locked path.
    • No permission to unlock: lock as user A, then sign in as a developer (user B) → the disclosure shows "You do not have permission to unlock this directory." instead of the unlock button.
    • Signed out or feature flag off: signed-out users see no lock button; with the flag disabled, the legacy Lock/Unlock button group behaves as before (full page reload).

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