From f11a4d5ef07e2966423d08376257cbe7451cde0d Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 13 Aug 2013 10:11:15 -0700 Subject: [PATCH] Pass branch information to local Conduit calls in Diffusion Summary: Fixes T3697. Currently, we don't pass "branch" implicitly, so, e.g., when viewing a branch you don't get the right commit hash when looking up the README. Test Plan: Viewed a non-`master` branch with a README, no fatal. Poked around and couldn't find anything suspicious. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3697 Differential Revision: https://secure.phabricator.com/D6734 --- .../conduit/ConduitAPI_diffusion_abstractquery_Method.php | 5 ++++- .../diffusion/controller/DiffusionBrowseController.php | 2 +- src/applications/diffusion/query/DiffusionQuery.php | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php index 1da13b9b4c..ea09339d33 100644 --- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php +++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php @@ -90,7 +90,9 @@ abstract class ConduitAPI_diffusion_abstractquery_Method final public function defineParamTypes() { return $this->defineCustomParamTypes() + array( - 'callsign' => 'required string'); + 'callsign' => 'required string', + 'branch' => 'optional string', + ); } /** * Subclasses should override this to specify custom param types. @@ -139,6 +141,7 @@ abstract class ConduitAPI_diffusion_abstractquery_Method array( 'user' => $request->getUser(), 'callsign' => $request->getValue('callsign'), + 'branch' => $request->getValue('branch'), 'path' => $request->getValue('path'), 'commit' => $request->getValue('commit'), )); diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index a77a0fff17..ffe66a6055 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -86,7 +86,7 @@ final class DiffusionBrowseController extends DiffusionController { $readme = $this->callConduitWithDiffusionRequest( 'diffusion.readmequery', array( - 'paths' => $results->getPathDicts() + 'paths' => $results->getPathDicts(), )); if ($readme) { $box = new PHUIBoxView(); diff --git a/src/applications/diffusion/query/DiffusionQuery.php b/src/applications/diffusion/query/DiffusionQuery.php index f377afb839..992cc6b6d6 100644 --- a/src/applications/diffusion/query/DiffusionQuery.php +++ b/src/applications/diffusion/query/DiffusionQuery.php @@ -53,8 +53,13 @@ abstract class DiffusionQuery extends PhabricatorQuery { $repository = $drequest->getRepository(); $core_params = array( - 'callsign' => $repository->getCallsign() + 'callsign' => $repository->getCallsign(), ); + + if ($drequest->getBranch() !== null) { + $core_params['branch'] = $drequest->getBranch(); + } + $params = $params + $core_params; return id(new ConduitCall(