From: Marcel Werk Date: Tue, 23 Jun 2020 15:38:51 +0000 (+0200) Subject: Merge branch '3.1' into 5.2 X-Git-Tag: 5.2.7~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=227cfaa7eb148e2a1ff7df2bd2cd14681596180d;p=GitHub%2FWoltLab%2FWCF.git Merge branch '3.1' into 5.2 --- 227cfaa7eb148e2a1ff7df2bd2cd14681596180d diff --cc wcfsetup/install/files/lib/data/article/content/ViewableArticleContentList.class.php index a4600f811f,c2cef7ea8a..f859f92176 --- a/wcfsetup/install/files/lib/data/article/content/ViewableArticleContentList.class.php +++ b/wcfsetup/install/files/lib/data/article/content/ViewableArticleContentList.class.php @@@ -41,36 -40,21 +41,38 @@@ class ViewableArticleContentList extend if ($articleContent->hasEmbeddedObjects) { $embeddedObjectPostIDs[] = $articleContent->articleContentID; } + + $articleIDs[] = $articleContent->articleID; } + $contentLanguageID = null; + if (count($this->objects) === 1) { + $contentLanguageID = reset($this->objects)->languageID; + } + // cache images if (!empty($imageIDs)) { - $mediaList = new ViewableMediaList(); + $mediaList = new ViewableMediaList($contentLanguageID); $mediaList->setObjectIDs($imageIDs); $mediaList->readObjects(); $images = $mediaList->getObjects(); - - foreach ($this->getObjects() as $articleContent) { + } + + // load embedded objects + if (!empty($embeddedObjectPostIDs)) { - $contentLanguageID = null; - if (count($embeddedObjectPostIDs) === 1) $contentLanguageID = reset($this->objects)->languageID; - + MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.article.content', $embeddedObjectPostIDs, $contentLanguageID); + } + + if (!empty($articleIDs)) { + $articleList = new ViewableArticleList(); + // to prevent an infinity loop, because the list loads otherwise the article content + $articleList->enableContentLoading(false); + $articleList->setObjectIDs($articleIDs); + $articleList->readObjects(); + } + + foreach ($this->getObjects() as $articleContent) { + if (isset($images)) { if ($articleContent->imageID && isset($images[$articleContent->imageID])) { $articleContent->setImage($images[$articleContent->imageID]); }