Posts: Provide a HiDPI version for the avatar used in post locked dialogs.

Props wpdesk, audrasjb, ocean90.
Fixes #39633.
Built from https://develop.svn.wordpress.org/trunk@48318


git-svn-id: http://core.svn.wordpress.org/trunk@48087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2020-07-05 13:00:07 +00:00
parent 618eeabba8
commit 56afcf2d68
6 changed files with 25 additions and 13 deletions

View File

@ -1053,9 +1053,9 @@ function wp_check_locked_posts( $response, $data, $screen_id ) {
'text' => sprintf( __( '%s is currently editing' ), $user->display_name ),
);
$avatar = get_avatar( $user->ID, 18 );
if ( $avatar && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
$send['avatar_src'] = $matches[1];
if ( get_option( 'show_avatars' ) ) {
$send['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 18 ) );
$send['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 36 ) );
}
$checked[ $key ] = $send;
@ -1103,11 +1103,9 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
);
$avatar = get_avatar( $user->ID, 64 );
if ( $avatar ) {
if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
$error['avatar_src'] = $matches[1];
}
if ( get_option( 'show_avatars' ) ) {
$error['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 64 ) );
$error['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 128 ) );
}
$send['lock_error'] = $error;

View File

@ -529,7 +529,14 @@ $( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
row.find('.check-column checkbox').prop('checked', false);
if ( lock_data.avatar_src ) {
avatar = $( '<img class="avatar avatar-18 photo" width="18" height="18" alt="" />' ).attr( 'src', lock_data.avatar_src.replace( /&amp;/g, '&' ) );
avatar = $( '<img />', {
'class': 'avatar avatar-18 photo',
width: 18,
height: 18,
alt: '',
src: lock_data.avatar_src,
srcset: lock_data.avatar_src_2x ? lock_data.avatar_src_2x + ' 2x' : undefined
} );
row.find('.column-title .locked-avatar').empty().append( avatar );
}
row.addClass('wp-locked');

File diff suppressed because one or more lines are too long

View File

@ -200,7 +200,14 @@ window.wp = window.wp || {};
}
if ( received.lock_error.avatar_src ) {
avatar = $( '<img class="avatar avatar-64 photo" width="64" height="64" alt="" />' ).attr( 'src', received.lock_error.avatar_src.replace( /&amp;/g, '&' ) );
avatar = $( '<img />', {
'class': 'avatar avatar-64 photo',
width: 64,
height: 64,
alt: '',
src: received.lock_error.avatar_src,
srcset: received.lock_error.avatar_src_2x ? received.lock_error.avatar_src_2x + ' 2x' : undefined
} );
wrap.find('div.post-locked-avatar').empty().append( avatar );
}

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48317';
$wp_version = '5.5-alpha-48318';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.