Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions components/ILIAS/Forum/classes/class.ilObjForumGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use ILIAS\Forum\Drafts\ForumDraftsTable;
use ILIAS\Forum\Notification\NotificationType;
use ILIAS\User\Profile\PublicProfileGUI;
use ILIAS\ResourceStorage\Services as IRSS;

/**
* @ilCtrl_Calls ilObjForumGUI: ilPermissionGUI, ilForumExportGUI, ilInfoScreenGUI
Expand Down Expand Up @@ -74,6 +75,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
public ilHelpGUI $ilHelp;
private Factory $factory;
private Renderer $renderer;
private IRSS $irss;

private int $selectedSorting;
private ilForumThreadSettingsSessionStorage $selected_post_storage;
Expand All @@ -93,6 +95,8 @@ public function __construct($data, int $id = 0, bool $call_by_reference = true,
$this->uiRenderer = $DIC->ui()->renderer();
$this->globalScreen = $DIC->globalScreen();

$this->irss = $DIC->resourceStorage();

$this->ilObjDataCache = $DIC['ilObjDataCache'];
$this->ilNavigationHistory = $DIC['ilNavigationHistory'];
$this->ilHelp = $DIC['ilHelp'];
Expand Down Expand Up @@ -3344,6 +3348,7 @@ public function viewThreadObject(): void

$this->ensureValidPageForCurrentPosting($subtree_nodes, $pagedPostings, $pageSize, $firstNodeInThread);

$this->preloadPostingFileResources($pagedPostings, $draftsObjects);
if ($doRenderDrafts && $pageIndex === 0 &&
$this->selectedSorting === ilForumProperties::VIEW_DATE_DESC) {
foreach ($draftsObjects as $draft) {
Expand Down Expand Up @@ -5888,4 +5893,31 @@ private function getOrderByParam(): string
])
));
}

/**
* @param ilForumPost[] $postings
* @param ilForumPostDraft[] $draftsObjects
*/
private function preloadPostingFileResources(array $postings, array $draftsObjects): void
{
$collectionIds = [];

foreach ($postings as $posting) {
$rcid = $posting->getRCID();
if ($rcid !== ilForumPost::NO_RCID && !empty($rcid)) {
$collection_ids[] = $rcid;
}
}

foreach ($draftsObjects as $draft) {
$rcid = $draft->getRCID();
if ($rcid !== ilForumPostDraft::NO_RCID && !empty($rcid)) {
$collection_ids[] = $rcid;
}
}

if (!empty($collection_ids)) {
$this->irss->preloadCollections(array_unique($collection_ids));
}
}
}