mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 12:43:52 +08:00
Only touch orders property if we're going to add to it
This commit is contained in:
parent
c7d7b2d360
commit
20f6a256d5
|
@ -45,16 +45,16 @@ class PinStickiedDiscussionsToTop
|
|||
$search = $event->search;
|
||||
$query = $search->getQuery();
|
||||
|
||||
if (! is_array($query->orders)) {
|
||||
$query->orders = [];
|
||||
}
|
||||
|
||||
// If we are viewing a specific tag, then pin all stickied
|
||||
// discussions to the top no matter what.
|
||||
$gambits = $search->getActiveGambits();
|
||||
|
||||
foreach ($gambits as $gambit) {
|
||||
if ($gambit instanceof TagGambit) {
|
||||
if (! is_array($query->orders)) {
|
||||
$query->orders = [];
|
||||
}
|
||||
|
||||
array_unshift($query->orders, ['column' => 'is_sticky', 'direction' => 'desc']);
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user