Add support for pending users to UserProfile::canSeeAvatar()
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 18 Nov 2020 10:51:56 +0000 (11:51 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 18 Nov 2020 13:13:17 +0000 (14:13 +0100)
wcfsetup/install/files/lib/data/user/UserProfile.class.php

index cd0bf855cd8c300340a166a50be202370e87bd49..74df9bc3b4ca6a40a66dc4f0d3cae4c864ebad00 100644 (file)
@@ -352,7 +352,11 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject {
         * @return      boolean
         */
        public function canSeeAvatar() {
-               return (WCF::getUser()->userID == $this->userID || WCF::getSession()->getPermission('user.profile.avatar.canSeeAvatars'));
+               return (
+                       WCF::getUser()->userID == $this->userID ||
+                       WCF::getSession()->getPermission('user.profile.avatar.canSeeAvatars') ||
+                       (($pending = WCF::getSession()->getPendingUserChange()) && $pending->userID == $this->userID)
+               );
        }
        
        /**