Loading
Add lock button component
What does this MR do and why?
Part 1 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 |
Adds an EE lock_button.vue component that surfaces who locked a file/directory. It handles:
- Render the lock button in different states based on 1) file/directory is locked or not 2) do users have permissions to create/destroy locks 3) FF is on or off
- Shows confirmation modal and toast for unlock/lock
- Renders a disclosure dropdown with locker information (avatar, user name, work, organization, location, local time) based on
UsersCache - Slot to render additional information for directory lock
References
Screenshots or screen recordings
Note
This MR purely adds the component, screenshots below is based on running the integration branch !246286 (merged) and following the validation steps below:
| 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




