Skip to content

Commit 8264f1d

Browse files
committed
Isues-360: announcements and discussions are sorted by date in recent discussions
1 parent cf51d71 commit 8264f1d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

vanilla/applications/vanilla/controllers/class.discussionscontroller.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public function index($Page = false) {
159159
$categoryIDs = $this->getCategoryIDs();
160160
// Fix to segregate announcement conditions until announcement caching has been reworked.
161161
// See https://github.com/vanilla/vanilla/issues/7241
162-
$where = $announcementsWhere = [];
162+
$where = ['Announce' => 'all'];
163+
// Get Discussions and Announcements
163164
if ($this->data('Followed')) {
164165
$followedCategories = array_keys($categoryModel->getFollowed(Gdn::session()->UserID));
165166
$visibleCategoriesResult = CategoryModel::instance()->getVisibleCategoryIDs(['filterHideDiscussions' => true]);
@@ -170,7 +171,7 @@ public function index($Page = false) {
170171
}
171172
$where['d.CategoryID'] = $visibleFollowedCategories;
172173
} elseif ($categoryIDs) {
173-
$where['d.CategoryID'] = $announcementsWhere['d.CategoryID'] = CategoryModel::filterCategoryPermissions($categoryIDs);
174+
$where['d.CategoryID'] = CategoryModel::filterCategoryPermissions($categoryIDs);
174175
} else {
175176
$visibleCategoriesResult = CategoryModel::instance()->getVisibleCategoryIDs(['filterHideDiscussions' => true]);
176177
if ($visibleCategoriesResult !== true) {
@@ -189,11 +190,7 @@ public function index($Page = false) {
189190

190191
$this->setData('CountDiscussions', $CountDiscussions);
191192

192-
// Get Announcements
193-
$this->AnnounceData = $Offset == 0 ? $DiscussionModel->getAnnouncements($announcementsWhere) : false;
194-
$this->setData('Announcements', $this->AnnounceData !== false ? $this->AnnounceData : [], true);
195-
196-
// Get Discussions
193+
// Get Discussions and Announcements
197194
$this->DiscussionData = $DiscussionModel->getWhereRecent($where, $Limit, $Offset);
198195

199196
$this->setData('Discussions', $this->DiscussionData, true);

0 commit comments

Comments
 (0)