Skip to content

Commit

Permalink
Site Logo: Fix user permission HTTP errors (#45104)
Browse files Browse the repository at this point in the history
* Site Logo: Fix user permission HTTP errors
* Use read-only site title
  • Loading branch information
Mamaduka authored Oct 19, 2022
1 parent 88a1f7a commit 8c5ad2f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ const SiteLogo = ( {
} );
const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
const siteEntities = select( coreStore ).getEditedEntityRecord(
const siteEntities = select( coreStore ).getEntityRecord(
'root',
'site'
'__unstableBase'
);
return {
title: siteEntities.title,
title: siteEntities?.name,
...pick( getSettings(), [ 'imageEditing', 'maxWidth' ] ),
};
}, [] );
Expand Down Expand Up @@ -370,12 +370,14 @@ export default function LogoEdit( {
} = useSelect( ( select ) => {
const { canUser, getEntityRecord, getEditedEntityRecord } =
select( coreStore );
const siteSettings = getEditedEntityRecord( 'root', 'site' );
const siteData = getEntityRecord( 'root', '__unstableBase' );
const _siteLogo = siteSettings?.site_logo;
const _readOnlyLogo = siteData?.site_logo;
const _canUserEdit = canUser( 'update', 'settings' );
const _siteLogoId = _canUserEdit ? _siteLogo : _readOnlyLogo;
const siteSettings = _canUserEdit
? getEditedEntityRecord( 'root', 'site' )
: undefined;
const siteData = getEntityRecord( 'root', '__unstableBase' );
const _siteLogoId = _canUserEdit
? siteSettings?.site_logo
: siteData?.site_logo;
const _siteIconId = siteSettings?.site_icon;
const mediaItem =
_siteLogoId &&
Expand Down

0 comments on commit 8c5ad2f

Please sign in to comment.