Skip to content

Commit

Permalink
fix: Show lock status for read only files and allow unlocking
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed May 10, 2024
1 parent 87b8ab9 commit 83ec0b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const inlineAction = new FileAction({
const node = nodes[0]
const state = getLockStateFromAttributes(node)

return (node.permissions & Permission.UPDATE) !== 0 && state.isLocked
return state.isLocked
},
})

Expand Down Expand Up @@ -115,8 +115,10 @@ const menuAction = new FileAction({
}

const canToggleLock = canLock(nodes[0]) || canUnlock(nodes[0])
const isLocked = getLockStateFromAttributes(nodes[0]).isLocked
const isUpdatable = (nodes[0].permissions & Permission.UPDATE) !== 0

return nodes[0].type === FileType.File && canToggleLock && (nodes[0].permissions & Permission.UPDATE) !== 0
return nodes[0].type === FileType.File && canToggleLock && (isUpdatable || isLocked)
},

async exec(node: Node) {
Expand Down

0 comments on commit 83ec0b0

Please sign in to comment.