Skip to content

Commit

Permalink
Merge pull request #306 from nextcloud/fix/lock-status-readonly
Browse files Browse the repository at this point in the history
fix: Show lock status for read only files and allow unlocking
  • Loading branch information
juliushaertl committed May 10, 2024
2 parents 484af25 + 3a262bf commit 343a65e
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 343a65e

Please sign in to comment.