Editor: Respect `show_avatars` option in block editor and Customizer.

This adds checks for the `show_avatars` option before setting the avatar for post lock modals in the block editor and the Customizer.

Follow-up to [41839], [53070].

Props ffffelix.
Fixes #62081.
Built from https://develop.svn.wordpress.org/trunk@59078


git-svn-id: http://core.svn.wordpress.org/trunk@58474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-09-22 22:50:18 +00:00
parent d2c835af27
commit 82c0168bbd
7 changed files with 31 additions and 13 deletions

View File

@ -32,7 +32,7 @@ body {
max-width: 366px;
min-height: 64px;
width: auto;
padding: 25px 109px 25px 25px;
padding: 25px;
position: relative;
background: #fff;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
@ -42,6 +42,10 @@ body {
top: calc( 50% - 100px );
}
#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .customize-changeset-locked-message.has-avatar {
padding-right: 109px;
}
#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .currently-editing {
margin-top: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ body {
max-width: 366px;
min-height: 64px;
width: auto;
padding: 25px 25px 25px 109px;
padding: 25px;
position: relative;
background: #fff;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
@ -41,6 +41,10 @@ body {
top: calc( 50% - 100px );
}
#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .customize-changeset-locked-message.has-avatar {
padding-left: 109px;
}
#customize-controls #customize-notifications-area .notice.notification-overlay.notification-changeset-locked .currently-editing {
margin-top: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -160,9 +160,12 @@ if ( $user_id ) {
if ( $locked ) {
$user = get_userdata( $user_id );
$user_details = array(
'avatar' => get_avatar_url( $user_id, array( 'size' => 128 ) ),
'name' => $user->display_name,
'name' => $user->display_name,
);
if ( get_option( 'show_avatars' ) ) {
$user_details['avatar'] = get_avatar_url( $user_id, array( 'size' => 128 ) );
}
}
$lock_details = array(

View File

@ -3334,11 +3334,16 @@ final class WP_Customize_Manager {
return null;
}
return array(
'id' => $lock_user->ID,
'name' => $lock_user->display_name,
'avatar' => get_avatar_url( $lock_user->ID, array( 'size' => 128 ) ),
$user_details = array(
'id' => $lock_user->ID,
'name' => $lock_user->display_name,
);
if ( get_option( 'show_avatars' ) ) {
$user_details['avatar'] = get_avatar_url( $lock_user->ID, array( 'size' => 128 ) );
}
return $user_details;
}
/**
@ -4307,8 +4312,10 @@ final class WP_Customize_Manager {
<script type="text/html" id="tmpl-customize-changeset-locked-notification">
<li class="notice notice-{{ data.type || 'info' }} {{ data.containerClasses || '' }}" data-code="{{ data.code }}" data-type="{{ data.type }}">
<div class="notification-message customize-changeset-locked-message">
<img class="customize-changeset-locked-avatar" src="{{ data.lockUser.avatar }}" alt="{{ data.lockUser.name }}" />
<div class="notification-message customize-changeset-locked-message {{ data.lockUser.avatar ? 'has-avatar' : '' }}">
<# if ( data.lockUser.avatar ) { #>
<img class="customize-changeset-locked-avatar" src="{{ data.lockUser.avatar }}" alt="{{ data.lockUser.name }}" />
<# } #>
<p class="currently-editing">
<# if ( data.message ) { #>
{{{ data.message }}}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-59077';
$wp_version = '6.7-alpha-59078';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.