[Draft] Commit changes modal: Disable commit to default branch for locked file/directory
Problem
Context: #516868 (closed)
Our implementation of File Locking is representative of soft locks. Users are not able to merge changes into the default branch if a file/directory is locked. Users on non-default branches can still make changes to the locked file/directory on non-default branches. This impacts the following actions on the Single File page:
Replace
Delete
-
Edit
>Commit changes
When a file is locked by another user, the Unlock
action is not available to other users on the default branch, and non-default branches. The Replace
and Delete
actions, and Commit changes
radio button to commit changes to the default branch are still available to users on the default branch, even though file modification is restricted to the user who has permission to unlock the file or Maintainers.
It's possible to go through replacing and deleting flow, which eventually returns an error from the backend when submitting the change. This is not user-friendly.
Implementation breakdown
Design change | Issue |
---|---|
Default branch updates
|
|
Commit changes modal updates
|
#521439 (this) |
Edit page updates
|
Design Proposal
We should indicate the user that they cannot perform the action earlier and prevent them into running to an error. The following changes should be addressed for the commit changes modal for the Replace
Delete
Edit
actions on the single file page.
Replace
User HAS permission to commit to branch + HAS permission to unlock file | User HAS permission to commit to branch + does NOT have permission to unlock file | User does NOT have permission to commit to branch + does NOT have permission to unlock file | |
---|---|---|---|
Default branch |
No change |
TBD | TBD |
Non-default branch |
No change |
TBD | TBD |
Delete
User HAS permission to commit to branch + HAS permission to unlock file | User HAS permission to commit to branch + does NOT have permission to unlock file | User does NOT have permission to commit to branch + does NOT have permission to unlock file | |
---|---|---|---|
Default branch |
No change |
TBD | TBD |
Non-default branch |
No change |
TBD | TBD |
Edit
User HAS permission to commit to branch + HAS permission to unlock file | User HAS permission to commit to branch + does NOT have permission to unlock file | User does NOT have permission to commit to branch + does NOT have permission to unlock file | |
---|---|---|---|
Default branch |
No change |
You don't have permission to modify this locked file on |
You don't have permission to modify this locked file or commit to |
Non-default branch |
No change |
TBD | TBD |