Loading
Surface file lock details in blob controls
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) | |
| Update documentation |
Wires the lock file button (added in !246285 (merged)) into the blob controls row, replacing the heading lock icon and the file actions Lock/Unlock dropdown item for files.
Data plumbing:
- The
locked-fileevent has been removed from bothblob_overflow_menuandblob_controls. Lock state for files is no longer passed through component events. blob_controls.vuenow runs theprojectInfoGraphQL query directly. Lock state is derived from the Apollo cache by matching the current blob path against the project'spathLocksnodes.- Lock and unlock mutations (in both the new lock button and the legacy lock dropdown item) use
refetchQuerieswithawaitRefetchQuerieson theprojectInfoquery, so every lock UI surface stays consistent through the Apollo cache without relying on event propagation. - The
pathLocksGraphQL fragment now also requestscreatedAton the lock andavatarUrlpluswebPathon the lock user.
References
- Issue: #545279 (closed)
Dependencies
- Component MR: !246285 (merged)
- Backend MR: !249031 (merged) — per multi-version compatibility, it must be deployed to production (not just merged) before this MR merges
Screenshots or screen recordings
| File/directory is locked | File/directory is NOT locked | |
|---|---|---|
| User has permission to lock/unlock | ![]() |
![]() |
| User does NOT have permission to lock/unlock | ![]() |
![]() |
| FF is off | ![]() |
How to set up and validate locally
- Enable
repository_lock_information - As a maintainer, open any file in a project repository (
/<group>/<project>/-/blob/master/README.md). - Lock flow: a Lock button appears → click it → confirm modal ("Lock file?" / "Are you sure you want to lock README.md?") → confirm → "The file is locked." toast, and the button becomes a Locked disclosure with your avatar (no page reload).
- Disclosure: open it → header shows "Locked by <name> · <time ago>", user card links to the profile, and extra details (job title, organization, location, local time) load lazily — fill those in on your user profile (Edit profile) to see them.
- Unlock flow: click Unlock file → confirm modal → "The file is unlocked." toast, button reverts to Lock.
- No permission to unlock: lock the file as user A, then sign in as a developer (user B) → the disclosure shows "You do not have permission to unlock this file." instead of the unlock button.
- Cannot lock: as a user who cannot push (for example, a guest, or signed out), the component renders nothing on an unlocked file.
- Feature flag off:
Feature.disable(:repository_lock_information)→ the component renders nothing even on a locked 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.
Edited by Chaoyue Zhao




