make UserAvatarCondition::checkUser() work correctly
authorJoshua Rüsweg <josh@bastelstu.be>
Mon, 9 Feb 2015 19:06:20 +0000 (20:06 +0100)
committerJoshua Rüsweg <josh@bastelstu.be>
Mon, 9 Feb 2015 19:06:20 +0000 (20:06 +0100)
atm the UserAvatarCondition is unusable, because it returns nonsense. The column ```avatar``` isn't provided by the database. And if the user has a gravatar the condition for NO_AVATAR returns ```true```, but actually the method should return ```false```.

wcfsetup/install/files/lib/system/condition/UserAvatarCondition.class.php

index 37af27078836f8bf96e3540956b19d595e9bdda4..f20fd00e0b3324dcfc083a410f34db86991680d5 100644 (file)
@@ -9,7 +9,7 @@ use wcf\system\WCF;
  * Condition implementation for the avatar of a user.
  * 
  * @author     Matthias Schmidt
- * @copyright  2001-2014 WoltLab GmbH
+ * @copyright  2001-2015 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.condition
@@ -69,11 +69,11 @@ class UserAvatarCondition extends AbstractSelectCondition implements IContentCon
        public function checkUser(Condition $condition, User $user) {
                switch ($condition->userAvatar) {
                        case self::NO_AVATAR:
-                               return !$user->avatar;
+                               return !$user->avatarID && !$user->enableGravatar;
                        break;
                        
                        case self::AVATAR:
-                               return $user->avatar != 0;
+                               return $user->avatarID != 0;
                        break;
                        
                        case self::GRAVATAR: