From: Matthias Schmidt Date: Sat, 7 Dec 2019 16:23:05 +0000 (+0100) Subject: Fix calling ViewableArticle::getUnreadArticlesForCategory() with different ids X-Git-Tag: 5.2.0_RC_1~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=41692873470da4c47f3f89863af96a6609638e47;p=GitHub%2FWoltLab%2FWCF.git Fix calling ViewableArticle::getUnreadArticlesForCategory() with different ids --- diff --git a/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php b/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php index c523da874f..448bf072d8 100644 --- a/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php +++ b/wcfsetup/install/files/lib/data/article/ViewableArticle.class.php @@ -299,6 +299,17 @@ class ViewableArticle extends DatabaseObjectDecorator { self::$unreadArticlesByCategory[$articleCategoryID] = 0; } } + else if (!isset(self::$unreadArticlesByCategory[$articleCategoryID])) { + if (WCF::getUser()->userID) { + self::$unreadArticlesByCategory[$articleCategoryID] = self::fetchUnreadArticlesForCategory($articleCategoryID); + + // update storage unreadEntries + UserStorageHandler::getInstance()->update(WCF::getUser()->userID, 'unreadArticlesByCategory', serialize(self::$unreadArticlesByCategory)); + } + else { + self::$unreadArticlesByCategory[$articleCategoryID] = 0; + } + } return self::$unreadArticlesByCategory[$articleCategoryID]; }