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

Props wpdesk, audrasjb, ocean90.
Fixes #39633.

git-svn-id: https://develop.svn.wordpress.org/trunk@48318 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling
2020-07-05 12:58:20 +00:00
parent 42d51e4e2e
commit d65c0a770c
3 changed files with 22 additions and 10 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;