Skip to content

[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.

edit-error.png

edit-commit-error.png

Implementation breakdown

Design change Issue

Default branch updates

  • Default branch
  • Disable the Replace and Delete buttons for users who do not have permission to unlock a file

#516868 (closed)

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

#521439 (this)

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

#521831

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

commitchanges.png

No change

TBD TBD
Non-default branch

commitchanges.png

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

commitchanges.png

No change

TBD TBD
Non-default branch

commitchanges.png

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

commitchanges.png

No change

default_ can commit, can't unlock.jpg

You don't have permission to modify this locked file on main. What is file locking?

default_ can't commit, can't unlock.jpg

You don't have permission to modify this locked file or commit to main. What are protected branches and file locking?

Non-default branch

commitchanges.png

No change

TBD TBD
TBD @alyssatrinh
Edited by Alyssa Trinh