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

Vastly expanded macro.query's capabilities

Summary:
Depends on D5420; Fixes T2822

Increased `macro.query`'s capabilities by at least 9001%!

Test Plan: Used it in several combination of query strings. Behaves as expected.

Reviewers: epriestley

CC: aran, Korvin

Maniphest Tasks: T2822

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

authored by

Anh Nhan Nguyen and committed by
epriestley
92003b68 9a6c912e

+44 -4
+44 -4
src/applications/macro/conduit/ConduitAPI_macro_query_Method.php
··· 11 11 12 12 public function defineParamTypes() { 13 13 return array( 14 + 'authorPHIDs' => 'optional list<phid>', 15 + 'phids' => 'optional list<phid>', 16 + 'ids' => 'optional list<id>', 17 + 'names' => 'optional list<string>', 18 + 'nameLike' => 'optional string', 14 19 ); 15 20 } 16 21 ··· 24 29 } 25 30 26 31 protected function execute(ConduitAPIRequest $request) { 27 - $macros = id(new PhabricatorMacroQuery()) 28 - ->setViewer($request->getUser()) 29 - ->execute(); 32 + $query = new PhabricatorMacroQuery(); 33 + $query->setViewer($request->getUser()); 34 + 35 + $author_phids = $request->getValue('authorPHIDs'); 36 + $phids = $request->getValue('phids'); 37 + $ids = $request->getValue('ids'); 38 + $name_like = $request->getValue('nameLike'); 39 + $names = $request->getValue('names'); 40 + 41 + if ($author_phids) { 42 + $query->withAuthorPHIDs($author_phids); 43 + } 44 + 45 + if ($phids) { 46 + $query->withPHIDs($phids); 47 + } 48 + 49 + if ($ids) { 50 + $query->withIDs($ids); 51 + } 52 + 53 + if ($name_like) { 54 + $query->withNameLike($name_like); 55 + } 56 + 57 + if ($names) { 58 + $query->withNames($names); 59 + } 60 + 61 + $macros = $query->execute(); 62 + 63 + if (!$macros) { 64 + return array(); 65 + } 30 66 31 67 $results = array(); 32 68 foreach ($macros as $macro) { 69 + $file = $macro->getFile(); 33 70 $results[$macro->getName()] = array( 34 - 'uri' => $macro->getFile()->getBestURI(), 71 + 'uri' => $file->getBestURI(), 72 + 'phid' => $macro->getPHID(), 73 + 'authorPHID' => $file->getAuthorPHID(), 74 + 'dateCreated' => $file->getDateCreated(), 35 75 ); 36 76 } 37 77