Skip to content

Commit

Permalink
fix(desk-tool): check for 'discardDraft' permission instead of 'delet…
Browse files Browse the repository at this point in the history
…e' in the DiscardDraft document action

Currently the DiscardDraft document action is checking for 'delete' permission, which requires 'update' permissions on both the draft and the published document and ends up inadvertently disabling the "Discard draft"-button for users that indeed have access to update the draft.
  • Loading branch information
bjoerge committed Oct 7, 2021
1 parent ecef92b commit a6423ce
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const DiscardChangesAction: DocumentActionComponent = ({
}) => {
const {discardChanges}: any = useDocumentOperation(id, type)
const [isConfirmDialogOpen, setConfirmDialogOpen] = useState(false)
const deleteDraftPermission = useCheckDocumentPermission(id, type, 'delete')
const deleteDraftPermission = useCheckDocumentPermission(id, type, 'discardDraft')
const {value: currentUser} = useCurrentUser()

const handleConfirm = useCallback(() => {
Expand Down

3 comments on commit a6423ce

@vercel
Copy link

@vercel vercel bot commented on a6423ce Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

studio-workshop – ./dev/workshop

studio-workshop.sanity.build
studio-workshop-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on a6423ce Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

@vercel
Copy link

@vercel vercel bot commented on a6423ce Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

perf-studio – ./

perf-studio.sanity.build
perf-studio-git-next.sanity.build

Please sign in to comment.