From 27c5f61e3070dc53c3a93c6b5577d0363e81b05e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 22 Aug 2021 23:01:14 +0200 Subject: [PATCH] [ticket/15769] Fix JS and avatar functional tests PHPBB3-15769 --- phpBB/assets/javascript/phpbb-avatars.js | 13 +++++++------ tests/functional/avatar_acp_groups_test.php | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/phpBB/assets/javascript/phpbb-avatars.js b/phpBB/assets/javascript/phpbb-avatars.js index 8ee5daf46d..c67a970473 100644 --- a/phpBB/assets/javascript/phpbb-avatars.js +++ b/phpBB/assets/javascript/phpbb-avatars.js @@ -46,7 +46,7 @@ // Ensure we have an img for the cropping if (this.$box.children('img').length === 0) { - const $avatarImg = $(''); + const $avatarImg = $(''); $avatarImg.addClass('avatar'); this.image = $avatarImg; this.$box.prepend($avatarImg); @@ -181,15 +181,16 @@ } // Handle errors while deleting file - if (typeof response.error !== 'undefined') { - phpbb.alert(response.error.title, response.error.messages.join('
')); - } else { - alert = phpbb.alert(response.MESSAGE_TITLE, response.MESSAGE_TEXT); + if (typeof response.error === 'undefined') { + const alert = phpbb.alert(response.MESSAGE_TITLE, response.MESSAGE_TEXT); - setTimeout(function() { + setTimeout(() => { window.location = response.REFRESH_DATA.url.replace('&', '&'); + alert.hide(); }, response.REFRESH_DATA.time * 1000); phpbb.avatars.destroy(); + } else { + phpbb.alert(response.error.title, response.error.messages.join('
')); } }, diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php index 3dee764ef6..1ba5dc744f 100644 --- a/tests/functional/avatar_acp_groups_test.php +++ b/tests/functional/avatar_acp_groups_test.php @@ -38,12 +38,12 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av ), // Gravatar with incorrect size array( - 'The submitted avatar is 120 wide and 120 high. Avatars must be at least 20 wide and 20 high, but no larger than 90 wide and 90 high.', + 'The submitted avatar is 140 wide and 140 high. Avatars must be at least 40 wide and 40 high, but no larger than 120 wide and 120 high.', 'avatar_driver_gravatar', array( 'avatar_gravatar_email' => 'test@example.com', - 'avatar_gravatar_width' => 120, - 'avatar_gravatar_height' => 120, + 'avatar_gravatar_width' => 140, + 'avatar_gravatar_height' => 140, ), ), // Delete avatar image to reset group settings