Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] fix: Show lock status for read only files and allow unlocking #308

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading