@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.

Fix an export bug where queries specified in the URI ("?param=value") were ignored when filtering the result set

Summary:
Depends on D18968. Ref T13049. Currently, if you visit `/query/?param=value`, there is no `queryKey` for the page but we build a query later on.

Right now, we incorrectly link to `/query/all/export/` in this case (and export too many results), but we should actually link to `/query/<constructed query key>/export/` to export only the desired/previewed results.

Swap the logic around a little bit so we look at the query we're actually executing, not the original URI, to figure out the query key we should use when building the link.

Test Plan: Visited a `/?param=value` page, exported data, got a subset of the full data instead of everything.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13049

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

+13 -4
+13 -4
src/applications/search/controller/PhabricatorApplicationSearchController.php
··· 7 7 private $navigation; 8 8 private $queryKey; 9 9 private $preface; 10 + private $activeQuery; 10 11 11 12 public function setPreface($preface) { 12 13 $this->preface = $preface; ··· 43 44 44 45 protected function getSearchEngine() { 45 46 return $this->searchEngine; 47 + } 48 + 49 + protected function getActiveQuery() { 50 + if (!$this->activeQuery) { 51 + throw new Exception(pht('There is no active query yet.')); 52 + } 53 + 54 + return $this->activeQuery; 46 55 } 47 56 48 57 protected function validateDelegatingController() { ··· 157 166 // other features like "Bulk Edit" and "Export Data" work correctly. 158 167 $engine->saveQuery($saved_query); 159 168 } 169 + 170 + $this->activeQuery = $saved_query; 160 171 161 172 $nav->selectFilter( 162 173 'query/'.$saved_query->getQueryKey(), ··· 867 878 868 879 $engine = $this->getSearchEngine(); 869 880 $engine_class = get_class($engine); 870 - $query_key = $this->getQueryKey(); 871 - if (!$query_key) { 872 - $query_key = $engine->getDefaultQueryKey(); 873 - } 881 + 882 + $query_key = $this->getActiveQuery()->getQueryKey(); 874 883 875 884 $can_use = $engine->canUseInPanelContext(); 876 885 $is_installed = PhabricatorApplication::isClassInstalledForViewer(