Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15400425
D13227.id31971.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13227.id31971.diff
View Options
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -731,7 +731,7 @@
),
) + parent::getBuiltinOrders();
- // Alias the "newest" builtin to the historical key for it.
+ // Alias the "newest" builtin to the historical keys for it.
$orders['newest']['aliases'][] = self::ORDER_CREATED;
$orders = array_select_keys(
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -269,6 +269,7 @@
$fields[] = id(new PhabricatorSearchOrderField())
->setLabel(pht('Order By'))
->setKey('order')
+ ->setOrderAliases($query->getBuiltinOrderAliasMap())
->setOptions($orders);
}
diff --git a/src/applications/search/field/PhabricatorSearchOrderField.php b/src/applications/search/field/PhabricatorSearchOrderField.php
--- a/src/applications/search/field/PhabricatorSearchOrderField.php
+++ b/src/applications/search/field/PhabricatorSearchOrderField.php
@@ -4,6 +4,16 @@
extends PhabricatorSearchField {
private $options;
+ private $orderAliases;
+
+ public function setOrderAliases(array $order_aliases) {
+ $this->orderAliases = $order_aliases;
+ return $this;
+ }
+
+ public function getOrderAliases() {
+ return $this->orderAliases;
+ }
public function setOptions(array $options) {
$this->options = $options;
@@ -22,6 +32,16 @@
return $request->getStr($key);
}
+ protected function getValueForControl() {
+ // If the SavedQuery has an alias for an order, map it to the canonical
+ // name for the order so the correct option is selected in the dropdown.
+ $value = parent::getValueForControl();
+ if (isset($this->orderAliases[$value])) {
+ $value = $this->orderAliases[$value];
+ }
+ return $value;
+ }
+
protected function newControl() {
return id(new AphrontFormSelectControl())
->setOptions($this->getOptions());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 11:34 AM (5 d, 5 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709758
Default Alt Text
D13227.id31971.diff (2 KB)
Attached To
Mode
D13227: Make "Order By" field render correctly when showing a SavedQuery with an order alias
Attached
Detach File
Event Timeline
Log In to Comment