Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | public function buildQueryFromSavedQuery(PhabricatorSavedQuery $original) { | ||||
$extensions = $this->getEngineExtensions(); | $extensions = $this->getEngineExtensions(); | ||||
foreach ($extensions as $extension) { | foreach ($extensions as $extension) { | ||||
$extension->applyConstraintsToQuery($object, $query, $saved, $map); | $extension->applyConstraintsToQuery($object, $query, $saved, $map); | ||||
} | } | ||||
$order = $saved->getParameter('order'); | $order = $saved->getParameter('order'); | ||||
$builtin = $query->getBuiltinOrderAliasMap(); | $builtin = $query->getBuiltinOrderAliasMap(); | ||||
if (strlen($order) && isset($builtin[$order])) { | if (phutil_nonempty_string($order) && isset($builtin[$order])) { | ||||
valerio.bozzolan: ✅ I used `phlog()` to test possible values of `$order` and it seems to me that it always is… | |||||
$query->setOrder($order); | $query->setOrder($order); | ||||
} else { | } else { | ||||
// If the order is invalid or not available, we choose the first | // If the order is invalid or not available, we choose the first | ||||
// builtin order. This isn't always the default order for the query, | // builtin order. This isn't always the default order for the query, | ||||
// but is the first value in the "Order" dropdown, and makes the query | // but is the first value in the "Order" dropdown, and makes the query | ||||
// behavior more consistent with the UI. In queries where the two | // behavior more consistent with the UI. In queries where the two | ||||
// orders differ, this order is the preferred order for humans. | // orders differ, this order is the preferred order for humans. | ||||
$query->setOrder(head_key($builtin)); | $query->setOrder(head_key($builtin)); | ||||
▲ Show 20 Lines • Show All 1,436 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I used phlog() to test possible values of $order and it seems to me that it always is null or a string like "newest", "relevance", "oldest", etc.
The phutil_nonempty_string() will report alien types, and this is OK.