diff --git a/packages/sanity/src/structure/comments/plugin/field/CommentsField.tsx b/packages/sanity/src/structure/comments/plugin/field/CommentsField.tsx index 923410bcbb6..85a507ea6d5 100644 --- a/packages/sanity/src/structure/comments/plugin/field/CommentsField.tsx +++ b/packages/sanity/src/structure/comments/plugin/field/CommentsField.tsx @@ -92,7 +92,6 @@ function CommentFieldInner( const { comments, - hasPermission, isCommentsOpen, isCreatingDataset, mentionOptions, @@ -317,11 +316,6 @@ function CommentFieldInner( ], ) - // Render the default field component if the user doesn't have permission - if (!hasPermission) { - return props.renderDefault(props) - } - return ( {props.renderDefault({ diff --git a/packages/sanity/src/structure/comments/plugin/input/components/CommentsPortableTextInput.tsx b/packages/sanity/src/structure/comments/plugin/input/components/CommentsPortableTextInput.tsx index 21478ab7981..f803565f547 100644 --- a/packages/sanity/src/structure/comments/plugin/input/components/CommentsPortableTextInput.tsx +++ b/packages/sanity/src/structure/comments/plugin/input/components/CommentsPortableTextInput.tsx @@ -63,16 +63,8 @@ export const CommentsPortableTextInputInner = React.memo(function CommentsPortab const currentUser = useCurrentUser() const portal = usePortal() - const { - comments, - getComment, - hasPermission, - mentionOptions, - onCommentsOpen, - operation, - setStatus, - status, - } = useComments() + const {comments, getComment, mentionOptions, onCommentsOpen, operation, setStatus, status} = + useComments() const {setSelectedPath, selectedPath} = useCommentsSelectedPath() const {scrollToComment, scrollToGroup} = useCommentsScroll() const {handleOpenDialog} = useCommentsUpsell() @@ -510,11 +502,6 @@ export const CommentsPortableTextInputInner = React.memo(function CommentsPortab ) const showFloatingInput = Boolean(nextCommentSelection && popoverAuthoringReferenceElement) - // Render the default input if the user doesn't have permission - if (!hasPermission) { - return props.renderDefault(props) - } - return ( <> diff --git a/packages/sanity/src/structure/comments/src/context/comments/CommentsProvider.tsx b/packages/sanity/src/structure/comments/src/context/comments/CommentsProvider.tsx index 7bf3a4e5891..fdfb27e0b11 100644 --- a/packages/sanity/src/structure/comments/src/context/comments/CommentsProvider.tsx +++ b/packages/sanity/src/structure/comments/src/context/comments/CommentsProvider.tsx @@ -4,7 +4,6 @@ import { getPublishedId, useAddonDataset, useCurrentUser, - useDocumentValuePermissions, useEditState, useSchema, useUserListWithPermissions, @@ -83,14 +82,6 @@ export const CommentsProvider = memo(function CommentsProvider(props: CommentsPr // A map to keep track of the latest transaction ID for each comment document. const transactionsIdMap = useMemo(() => new Map(), []) - // We only need to check for read permission on the document since users with - // read permission on the document can both read and write comments. - // This is how permission work for the comments add-on dataset. - const [readPermission] = useDocumentValuePermissions({ - document: documentValue || {_type: documentType, _id: publishedId}, - permission: 'read', - }) - // When the latest transaction ID is received, we remove the transaction id from the map. const handleOnLatestTransactionIdReceived = useCallback( (commentDocumentId: string) => { @@ -276,8 +267,6 @@ export const CommentsProvider = memo(function CommentsProvider(props: CommentsPr isCommentsOpen, onCommentsOpen, - hasPermission: Boolean(readPermission?.granted), - comments: { data: threadItemsByStatus, error, @@ -299,7 +288,6 @@ export const CommentsProvider = memo(function CommentsProvider(props: CommentsPr getComment, isCommentsOpen, onCommentsOpen, - readPermission?.granted, threadItemsByStatus, error, loading, diff --git a/packages/sanity/src/structure/comments/src/context/comments/types.ts b/packages/sanity/src/structure/comments/src/context/comments/types.ts index 30ab2722e91..fb9ccc63a52 100644 --- a/packages/sanity/src/structure/comments/src/context/comments/types.ts +++ b/packages/sanity/src/structure/comments/src/context/comments/types.ts @@ -19,8 +19,6 @@ export interface CommentsContextValue { isCommentsOpen?: boolean onCommentsOpen?: () => void - hasPermission: boolean - comments: { data: { open: CommentThreadItem[]