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) ⬅️ we're here
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-file event has been removed from both blob_overflow_menu and blob_controls. Lock state for files is no longer passed through component events.
  • blob_controls.vue now runs the projectInfo GraphQL query directly. Lock state is derived from the Apollo cache by matching the current blob path against the project's pathLocks nodes.
  • Lock and unlock mutations (in both the new lock button and the legacy lock dropdown item) use refetchQueries with awaitRefetchQueries on the projectInfo query, so every lock UI surface stays consistent through the Apollo cache without relying on event propagation.
  • The pathLocks GraphQL fragment now also requests createdAt on the lock and avatarUrl plus webPath on the lock user.

References

Dependencies

Screenshots or screen recordings

File/directory is locked File/directory is NOT locked
User has permission to lock/unlock CleanShot 2026-08-06 at 16.18.25.png CleanShot 2026-08-06 at 16.17.00.png
User does NOT have permission to lock/unlock CleanShot 2026-08-06 at 16.33.48.png CleanShot 2026-08-06 at 16.35.30.png
FF is off CleanShot 2026-08-06 at 16.18.56.png

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

Merge request reports

Loading
Loading