@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 alternate filtering conditions in object selector dialog

Summary:
These didn't get updated either when the main search got rebuilt. Adjust and modernize them. Also this uses "exclude", which I couldn't find any callsites for but just missed, so restore that.

At some point I plan to swap this whole thing to ApplicationSearch and that will let us get rid of a bunch of stuff.

Test Plan: Searched for all filters, got sensible results, verified source object doesn't show up as a result.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, mbishopim3

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

+32 -10
+15 -10
src/applications/search/controller/PhabricatorSearchSelectController.php
··· 23 23 $query->setParameter('query', $query_str); 24 24 $query->setParameter('types', array($this->type)); 25 25 26 + $status_open = PhabricatorSearchRelationship::RELATIONSHIP_OPEN; 27 + 26 28 switch ($request->getStr('filter')) { 27 29 case 'assigned': 28 - $query->setParameter('owner', array($user->getPHID())); 29 - $query->setParameter('open', 1); 30 + $query->setParameter('ownerPHIDs', array($user->getPHID())); 31 + $query->setParameter('statuses', array($status_open)); 30 32 break; 31 33 case 'created'; 32 - $query->setParameter('author', array($user->getPHID())); 34 + $query->setParameter('authorPHIDs', array($user->getPHID())); 33 35 // TODO - if / when we allow pholio mocks to be archived, etc 34 36 // update this 35 37 if ($this->type != PholioPHIDTypeMock::TYPECONST) { 36 - $query->setParameter('open', 1); 38 + $query->setParameter('statuses', array($status_open)); 37 39 } 38 40 break; 39 41 case 'open': 40 - $query->setParameter('open', 1); 42 + $query->setParameter('statuses', array($status_open)); 41 43 break; 42 44 } 43 45 44 - $query->setParameter('exclude', $request->getStr('exclude')); 45 - $query->setParameter('limit', 100); 46 + $query->setParameter('excludePHIDs', array($request->getStr('exclude'))); 46 47 47 - $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); 48 - $results = $engine->executeSearch($query); 48 + $results = id(new PhabricatorSearchDocumentQuery()) 49 + ->setViewer($user) 50 + ->withSavedQuery($query) 51 + ->setOffset(0) 52 + ->setLimit(100) 53 + ->execute(); 49 54 50 - $phids = array_fill_keys($results, true); 55 + $phids = array_fill_keys(mpull($results, 'getPHID'), true); 51 56 $phids += $this->queryObjectNames($query_str); 52 57 53 58 $phids = array_keys($phids);
+17
src/applications/search/query/PhabricatorSearchDocumentQuery.php
··· 25 25 } 26 26 27 27 protected function willFilterPage(array $handles) { 28 + 29 + // NOTE: This is used by the object selector dialog to exclude the object 30 + // you're looking at, so that, e.g., a task can't be set as a dependency 31 + // of itself in the UI. 32 + 33 + // TODO: Remove this after object selection moves to ApplicationSearch. 34 + 35 + $exclude = array(); 36 + if ($this->savedQuery) { 37 + $exclude_phids = $this->savedQuery->getParameter('excludePHIDs', array()); 38 + $exclude = array_fuse($exclude_phids); 39 + } 40 + 28 41 foreach ($handles as $key => $handle) { 29 42 if (!$handle->isComplete()) { 30 43 unset($handles[$key]); 31 44 continue; 32 45 } 33 46 if ($handle->getPolicyFiltered()) { 47 + unset($handles[$key]); 48 + continue; 49 + } 50 + if (isset($exclude[$handle->getPHID()])) { 34 51 unset($handles[$key]); 35 52 continue; 36 53 }