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 a203f63
Showing 1 changed file with 9 additions and 0 deletions.
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,10 @@ 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 a203f63

Please sign in to comment.