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

Give ConduitAPIMethod->getMethodDescription() access to a real Viewer

Summary:
Ref T9964. The new `*.search` and `*.edit` methods generate documentation which depends on the viewer.

For example, the `*.search` methods show a reference table of the keys for all your saved queries.

Give them a real viewer to work with.

During normal execution, just populate this viewer with the request's viewer, so `$request->getViewer()` and `$this->getViewer()` both work and mean the same thing.

Test Plan: {F1023780}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

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

+18 -7
+2
src/applications/conduit/controller/PhabricatorConduitConsoleController.php
··· 19 19 return new Aphront404Response(); 20 20 } 21 21 22 + $method->setViewer($viewer); 23 + 22 24 $call_uri = '/api/'.$method->getAPIMethodName(); 23 25 24 26 $status = $method->getMethodStatus();
+12 -2
src/applications/conduit/method/ConduitAPIMethod.php
··· 9 9 extends Phobject 10 10 implements PhabricatorPolicyInterface { 11 11 12 + private $viewer; 12 13 13 14 const METHOD_STATUS_STABLE = 'stable'; 14 15 const METHOD_STATUS_UNSTABLE = 'unstable'; ··· 45 46 46 47 abstract protected function execute(ConduitAPIRequest $request); 47 48 48 - 49 - public function __construct() {} 50 49 51 50 public function getParamTypes() { 52 51 $types = $this->defineParamTypes(); ··· 110 109 } 111 110 112 111 public function executeMethod(ConduitAPIRequest $request) { 112 + $this->setViewer($request->getUser()); 113 + 113 114 return $this->execute($request); 114 115 } 115 116 ··· 209 210 } 210 211 211 212 return null; 213 + } 214 + 215 + final public function setViewer(PhabricatorUser $viewer) { 216 + $this->viewer = $viewer; 217 + return $this; 218 + } 219 + 220 + final public function getViewer() { 221 + return $this->viewer; 212 222 } 213 223 214 224 /* -( Paging Results )----------------------------------------------------- */
+3 -3
src/applications/search/engine/PhabricatorSearchEngineAPIMethod.php
··· 39 39 } 40 40 41 41 final public function getMethodDescription() { 42 - // TODO: We don't currently have a real viewer in this method. 43 - $viewer = PhabricatorUser::getOmnipotentUser(); 42 + $viewer = $this->getViewer(); 44 43 45 44 $engine = $this->newSearchEngine() 46 45 ->setViewer($viewer); ··· 76 75 } 77 76 ``` 78 77 79 - These builtin and saved queries are available: 78 + You can use these keys to select builtin queries and your configured saved 79 + queries: 80 80 EOTEXT 81 81 ); 82 82
+1 -2
src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php
··· 38 38 } 39 39 40 40 final public function getMethodDescription() { 41 - // TODO: We don't currently have a real viewer in this method. 42 - $viewer = PhabricatorUser::getOmnipotentUser(); 41 + $viewer = $this->getViewer(); 43 42 44 43 $engine = $this->newEditEngine() 45 44 ->setViewer($viewer);