Loading
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) | |
| 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 fromheader_area.vue(thedirectoryLocked/lockUserstate andlocked-directoryevent listener), since both the file and directory lock buttons now surface lock state themselves. The legacy directory button no longer emitslocked-directory.
References
- Issue: #545279 (closed)
Screenshots or screen recordings
| FF on | FF off | |
|---|---|---|
| Upstream lock | ![]() |
![]() |
| Downstream lock | ![]() |
![]() |
| User cannot unlock | ![]() |
![]() |
| Exact lock, user is the locker and can unlock | ![]() |
![]() |
| No lock | ![]() |
![]() |
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 directorya/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 toa. - Downstream lock: lock a file or directory inside
a(but notaitself), then visita→ 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).
- As a maintainer, open any directory in a project repository (
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









