Skip to content

Commit

Permalink
Replace 'canUserEditEntityRecord' selector usages
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 9, 2024
1 parent a876add commit 1227cc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export default function PostTitleEdit( {
if ( isDescendentOfQueryLoop ) {
return false;
}
return select( coreStore ).canUserEditEntityRecord(
return select( coreStore ).hasPermission(
'update',
'postType',
postType,
postId
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/utils/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useViewportMatch } from '@wordpress/compose';
export function useCanEditEntity( kind, name, recordId ) {
return useSelect(
( select ) =>
select( coreStore ).canUserEditEntityRecord( kind, name, recordId ),
select( coreStore ).hasPermission( 'update', kind, name, recordId ),
[ kind, name, recordId ]
);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/editor/src/bindings/post-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export default {
}

// Check that the user has the capability to edit post meta.
const canUserEdit = select( coreDataStore ).canUserEditEntityRecord(
const canUserEdit = select( coreDataStore ).hasPermission(
'update',
'postType',
context?.postType,
context?.postId
Expand Down

0 comments on commit 1227cc5

Please sign in to comment.