Skip to content

Commit

Permalink
Merge pull request #308 from nextcloud/backport/306/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Show lock status for read only files and allow unlocking
  • Loading branch information
juliusknorr authored May 10, 2024
2 parents 87b8ab9 + 83ec0b0 commit 80af1a9
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 80af1a9

Please sign in to comment.