@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make "Order By" field render correctly when showing a SavedQuery with an order alias

Summary:
If you have a saved query with an order alias, we currently apply the order correctly but don't show the right value in the UI.

Map any saved value to the canoncial value when rendering the control.

Test Plan: Added some `var_dump()` and verified order key was getting mapped forward correctly.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D13227

+21
+1
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 269 269 $fields[] = id(new PhabricatorSearchOrderField()) 270 270 ->setLabel(pht('Order By')) 271 271 ->setKey('order') 272 + ->setOrderAliases($query->getBuiltinOrderAliasMap()) 272 273 ->setOptions($orders); 273 274 } 274 275
+20
src/applications/search/field/PhabricatorSearchOrderField.php
··· 4 4 extends PhabricatorSearchField { 5 5 6 6 private $options; 7 + private $orderAliases; 8 + 9 + public function setOrderAliases(array $order_aliases) { 10 + $this->orderAliases = $order_aliases; 11 + return $this; 12 + } 13 + 14 + public function getOrderAliases() { 15 + return $this->orderAliases; 16 + } 7 17 8 18 public function setOptions(array $options) { 9 19 $this->options = $options; ··· 20 30 21 31 protected function getValueFromRequest(AphrontRequest $request, $key) { 22 32 return $request->getStr($key); 33 + } 34 + 35 + protected function getValueForControl() { 36 + // If the SavedQuery has an alias for an order, map it to the canonical 37 + // name for the order so the correct option is selected in the dropdown. 38 + $value = parent::getValueForControl(); 39 + if (isset($this->orderAliases[$value])) { 40 + $value = $this->orderAliases[$value]; 41 + } 42 + return $value; 23 43 } 24 44 25 45 protected function newControl() {