Improved display of assigned user in moderation list
authorMarcel Werk <burntime@woltlab.com>
Fri, 31 Mar 2017 11:27:56 +0000 (13:27 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 31 Mar 2017 11:27:56 +0000 (13:27 +0200)
see #2227

com.woltlab.wcf/templates/moderationList.tpl
wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php
wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php
wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueueList.class.php

index 9eb2293d0032ed82bdc0a9db3647ffbdc3881fb6..0913d17b7f9fe56f516b171e33ad37341d1b8500 100644 (file)
                                                        <div>
                                                                <p{if $entry->isNew()} title="{lang}wcf.moderation.markAsRead.doubleClick{/lang}"{/if}>{@$entry->getUserProfile()->getAvatar()->getImageTag(48)}</p>
                                                                
-                                                               {if $entry->assignedUserID == $__wcf->user->userID}
-                                                                       {if $__wcf->getUserProfileHandler()->getAvatar()}
-                                                                               <small class="myAvatar jsTooltip" title="{lang}wcf.moderation.assignedUser{/lang}">{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(24)}</small>
-                                                                       {/if}
+                                                               {if $entry->assignedUserID}
+                                                                       <small class="myAvatar jsTooltip" title="{lang}wcf.moderation.assignedUser{/lang}">{@$entry->getAssignedUserProfile()->getAvatar()->getImageTag(24)}</small>
                                                                {/if}
                                                        </div>
                                                </li>
index f39b7d61808b210c0adc780515297b0e105ac3ae..5a67fc7884856673ecfa6f94a6dc705867f39ebe 100644 (file)
@@ -131,7 +131,6 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction {
                        $queueList = new ViewableModerationQueueList();
                        $queueList->getConditionBuilder()->add("moderation_queue.queueID IN (?)", [$queueIDs]);
                        $queueList->sqlOrderBy = "moderation_queue.lastChangeTime DESC";
-                       $queueList->loadUserProfiles = true;
                        $queueList->readObjects();
                        foreach ($queueList as $queue) {
                                $queues[] = $queue;
@@ -148,7 +147,6 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction {
                        if (!empty($queueIDs)) $queueList->getConditionBuilder()->add("moderation_queue.queueID NOT IN (?)", [$queueIDs]);
                        $queueList->sqlOrderBy = "moderation_queue.lastChangeTime DESC";
                        $queueList->sqlLimit = $MAX_ITEMS - $count;
-                       $queueList->loadUserProfiles = true;
                        $queueList->readObjects();
                        foreach ($queueList as $queue) {
                                $queues[] = $queue;
index 6d010a3abbf9da643bf83734cab8db6a578ae27d..0cb6eda98f941db91a3df579c0107be76861978a 100644 (file)
@@ -110,6 +110,19 @@ class ViewableModerationQueue extends DatabaseObjectDecorator implements ILinkab
                return $this->userProfile;
        }
        
+       /**
+        * Returns assigned user profile object.
+        *
+        * @return      UserProfile|null
+        */
+       public function getAssignedUserProfile() {
+               if ($this->assignedUserID) {
+                       return UserProfileRuntimeCache::getInstance()->getObject($this->assignedUserID);
+               }
+               
+               return null;
+       }
+       
        /**
         * Returns true if associated object was removed.
         * 
index 1cbb4e373a9339df8463790ec28386256ead0fed..868437de3806426c2cbe1ab5f5b9dfcb7e45426f 100644 (file)
@@ -22,12 +22,6 @@ use wcf\system\WCF;
  * @property   ViewableModerationQueue[]       $objects
  */
 class ViewableModerationQueueList extends ModerationQueueList {
-       /**
-        * true, if objects should be populated with associated user profiles
-        * @var boolean
-        */
-       public $loadUserProfiles = false;
-       
        /**
         * @inheritDoc
         */
@@ -90,14 +84,13 @@ class ViewableModerationQueueList extends ModerationQueueList {
                                ModerationQueueManager::getInstance()->removeOrphans($queueIDs);
                        }
                        
-                       if ($this->loadUserProfiles) {
-                               $userIDs = [];
-                               foreach ($this->objects as $object) {
-                                       $userIDs[] = $object->getAffectedObject()->getUserID();
-                               }
-                               
-                               UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
+                       $userIDs = [];
+                       foreach ($this->objects as $object) {
+                               $userIDs[] = $object->getAffectedObject()->getUserID();
+                               if ($object->assignedUserID) $userIDs[] = $object->assignedUserID;
                        }
+                               
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                }
        }