return $orphanedEventIDs;
}
+
+ /**
+ * Truncates the items in object list to given number of items.
+ *
+ * @param integer $limit
+ */
+ public function truncate($limit) {
+ $this->objects = array_slice($this->objects, 0, $limit, true);
+ $this->indexToObject = array_keys($this->objects);
+ }
}
parent::readData();
$this->eventList = new ViewableUserActivityEventList();
+
+ // load more items than necessary to avoid empty list if some items are invisible for current user
+ $this->eventList->sqlLimit = 60;
+
$this->eventList->readObjects();
// add breadcrumbs
// removes orphaned and non-accessible events
UserActivityEventHandler::validateEvents($this->eventList);
+ // remove unused items
+ $this->eventList->truncate(20);
+
WCF::getTPL()->assign([
'eventList' => $this->eventList,
'lastEventTime' => $lastEventTime,
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\System\Box
* @since 3.0
+ *
+ * @property ViewableUserActivityEventList $objectList
*/
class RecentActivityListBoxController extends AbstractDatabaseObjectListBoxController {
/**
$this->objectList->getConditionBuilder()->add('user_activity_event.userID IN (?)', [WCF::getUserProfileHandler()->getFollowingUsers()]);
}
+ // load more items than necessary to avoid empty list if some items are invisible for current user
+ $this->objectList->sqlLimit = $this->box->limit * 3;
+
parent::readObjects();
- // removes orphaned and non-accessable events
+ // removes orphaned and non-accessible events
/** @noinspection PhpParamsInspection */
UserActivityEventHandler::validateEvents($this->objectList);
+
+ // remove unused items
+ $this->objectList->truncate($this->box->limit);
}
}
*/
public function getContent($userID) {
$eventList = new ViewableUserActivityEventList();
+
+ // load more items than necessary to avoid empty list if some items are invisible for current user
+ $eventList->sqlLimit = 60;
+
$eventList->getConditionBuilder()->add("user_activity_event.userID = ?", [$userID]);
$eventList->readObjects();
UserActivityEventHandler::validateEvents($eventList);
}
+ // remove unused items
+ $eventList->truncate(20);
+
WCF::getTPL()->assign([
'eventList' => $eventList,
'lastEventTime' => $lastEventTime,