Pwirth has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/356193 )

Change subject: BSAvatars: Added invalidation, so the user images can be 
changed properly
......................................................................

BSAvatars: Added invalidation, so the user images can be changed properly

* #6473
* also fixed statement that checks the user setting

=> needs cherry-pick to REL1_27

Change-Id: Id8bda88fabd44036704c11fcac750c4bb536708a
---
M Avatars/Avatars.class.php
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/93/356193/1

diff --git a/Avatars/Avatars.class.php b/Avatars/Avatars.class.php
index 773f393..40bed85 100644
--- a/Avatars/Avatars.class.php
+++ b/Avatars/Avatars.class.php
@@ -115,10 +115,12 @@
                        $oUserMiniProfileView->setOption('linktargethref', ''); 
# don't link to user page
                        return true;
                }
+
                # If user has set MW image or URL return immediately
-               if ($oUser->getOption('MW::UserImage')) {
+               if( !empty( $oUser->getOption( 'MW::UserImage' ) ) ) {
                        return true;
                }
+
                # Set default image in read-only mode or thumb creation might 
get triggered
                if (wfReadOnly()) {
                        
$oUserMiniProfileView->setUserImageSrc(BsConfig::get('MW::DefaultUserImage'));
@@ -200,9 +202,10 @@
         * @param User $oUser
         */
        public static function unsetUserImage($oUser) {
-               if ($oUser->getOption('MW::UserImage')) {
-                       $oUser->setOption('MW::UserImage', null);
+               if( $oUser->getOption( 'MW::UserImage' ) ) {
+                       $oUser->setOption( 'MW::UserImage', false );
                        $oUser->saveSettings();
+                       $oUser->invalidateCache();
                }
                return;
        }
@@ -268,6 +271,8 @@
                        if (!$oStatus->isGood())
                                throw new MWException('FATAL: Avatar thumbs 
could no be deleted!');
                        $oFile = 
BsFileSystemHelper::getFileFromRepoName($sAvatarFileName, 'Avatars');
+
+                       $oUser->invalidateCache();
                }
                $sNewUserImageSrc = $oFile->createThumb($iAvatarWidth, 
$iAvatarHeight);
                return $sNewUserImageSrc;

-- 
To view, visit https://gerrit.wikimedia.org/r/356193
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8bda88fabd44036704c11fcac750c4bb536708a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to