Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jul 11, 2024
1 parent b06762d commit 990eba6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/editor/src/components/global-styles-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ function useGlobalStylesUserConfig() {
} = select( coreStore );
const _globalStylesId =
select( coreStore ).__experimentalGetCurrentGlobalStylesId();

// Doing canUser( 'read', 'global_styles' ) returns false even for users with the capability.
// See: https://github.com/WordPress/gutenberg/issues/63438
// So we need to check the user capabilities directly.
const userId = getCurrentUser()?.id;
const canEditThemeOptions =
userId && getUser( userId )?.capabilities?.edit_theme_options;

const record =
_globalStylesId && canEditThemeOptions
? getEditedEntityRecord(
Expand Down Expand Up @@ -139,6 +144,11 @@ function useGlobalStylesBaseConfig() {
getUser,
__experimentalGetCurrentThemeBaseGlobalStyles,
} = select( coreStore );


// Doing canUser( 'read', 'global_styles' ) returns false even for users with the capability.
// See: https://github.com/WordPress/gutenberg/issues/63438
// So we need to check the user capabilities directly.
const userId = getCurrentUser()?.id;
const canEditThemeOptions =
userId && getUser( userId )?.capabilities?.edit_theme_options;
Expand Down

0 comments on commit 990eba6

Please sign in to comment.