[Draft] Commit changes modal: Disable commit to default branch for locked file/directory
# Problem
Context: https://gitlab.com/gitlab-org/gitlab/-/issues/516868
Our implementation of [File Locking](https://docs.gitlab.com/user/project/file_lock/) 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.
{width="1237" height="757"}
{width="774" height="365"}
# Implementation breakdown
<table>
<tr>
<th>Design change</th>
<th>Issue</th>
</tr>
<tr>
<td>
Default branch updates
* Default branch
* Disable the `Replace` and `Delete` buttons for users who do not have permission to unlock a file
</td>
<td>
https://gitlab.com/gitlab-org/gitlab/-/issues/516868
</td>
</tr>
<tr>
<td>
Commit changes modal updates
* Non-default branches
* Update the commit changes modal in the `Replace` `Delete` `Edit` flows to inform users of locking status when they do not have permission to unlock a file
</td>
<td>
https://gitlab.com/gitlab-org/gitlab/-/issues/521439 (this)
</td>
</tr>
<tr>
<td>
Edit page updates
* Update the `Edit` page or related flows to inform users of locking status when they do not have permission to unlock a file
</td>
<td>
https://gitlab.com/gitlab-org/gitlab/-/issues/521831
</td>
</tr>
</table>
# 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
<table>
<tr>
<th></th>
<th>User HAS permission to commit to branch + HAS permission to unlock file</th>
<th>User HAS permission to commit to branch + does NOT have permission to unlock file</th>
<th>User does NOT have permission to commit to branch + does NOT have permission to unlock file</th>
</tr>
<tr>
<td>Default branch</td>
<td>
{width="775" height="336"}
No change
</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>Non-default branch</td>
<td>
{width="775" height="336"}
No change
</td>
<td>TBD</td>
<td>TBD</td>
</tr>
</table>
### Delete
<table>
<tr>
<th></th>
<th>User HAS permission to commit to branch + HAS permission to unlock file</th>
<th>User HAS permission to commit to branch + does NOT have permission to unlock file</th>
<th>User does NOT have permission to commit to branch + does NOT have permission to unlock file</th>
</tr>
<tr>
<td>Default branch</td>
<td>
{width="775" height="336"}
No change
</td>
<td>TBD</td>
<td>TBD</td>
</tr>
<tr>
<td>Non-default branch</td>
<td>
{width="775" height="336"}
No change
</td>
<td>TBD</td>
<td>TBD</td>
</tr>
</table>
### Edit
<table>
<tr>
<th></th>
<th>User HAS permission to commit to branch + HAS permission to unlock file</th>
<th>User HAS permission to commit to branch + does NOT have permission to unlock file</th>
<th>User does NOT have permission to commit to branch + does NOT have permission to unlock file</th>
</tr>
<tr>
<td>Default branch</td>
<td>
{width="775" height="336"}
No change
</td>
<td>

You don't have permission to modify this locked file on `main`. [What is file locking?](https://docs.gitlab.com/user/project/file_lock/)
</td>
<td>

You don't have permission to modify this locked file or commit to `main`. What are [protected branches](https://docs.gitlab.com/user/project/repository/branches/protected/) and [file locking](https://docs.gitlab.com/user/project/file_lock/)?
</td>
</tr>
<tr>
<td>Non-default branch</td>
<td>
{width="775" height="336"}
No change
</td>
<td>TBD</td>
<td>TBD</td>
</tr>
</table>
##### _TBD @alyssatrinh_
issue