@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 issue with `differential.getdiff` when providing a revision ID

Summary:
If handed a revision ID, we might get more than one result, which causes `executeOne()` to throw. Instead, translate the revision id into a diff ID before querying for the diff.

Also one small consistency change to parameter casing.

Test Plan: Used console to query for a revision with more than one diff using the revision id.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, mbishopim3

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

+17 -12
+15 -10
src/applications/differential/conduit/ConduitAPI_differential_getdiff_Method.php
··· 43 43 } 44 44 45 45 protected function execute(ConduitAPIRequest $request) { 46 - $diff = null; 47 - $revision_ids = array(); 48 - $diff_ids = array(); 46 + $diff_id = $request->getValue('diff_id'); 49 47 48 + // If we have a revision ID, we need the most recent diff. Figure that out 49 + // without loading all the attached data. 50 50 $revision_id = $request->getValue('revision_id'); 51 51 if ($revision_id) { 52 - $revision_ids = array($revision_id); 52 + $diffs = id(new DifferentialDiffQuery()) 53 + ->setViewer($request->getUser()) 54 + ->withRevisionIDs(array($revision_id)) 55 + ->execute(); 56 + if ($diffs) { 57 + $diff_id = head($diffs)->getID(); 58 + } else { 59 + throw new ConduitException('ERR_BAD_DIFF'); 60 + } 53 61 } 54 - $diff_id = $request->getValue('diff_id'); 62 + 63 + $diff = null; 55 64 if ($diff_id) { 56 - $diff_ids = array($diff_id); 57 - } 58 - if ($diff_ids || $revision_ids) { 59 65 $diff = id(new DifferentialDiffQuery()) 60 66 ->setViewer($request->getUser()) 61 - ->withIDs($diff_ids) 62 - ->withRevisionIDs($revision_ids) 67 + ->withIDs(array($diff_id)) 63 68 ->needChangesets(true) 64 69 ->needArcanistProjects(true) 65 70 ->executeOne();
+2 -2
src/applications/differential/conduit/ConduitAPI_differential_querydiffs_Method.php
··· 13 13 public function defineParamTypes() { 14 14 return array( 15 15 'ids' => 'optional list<uint>', 16 - 'revison_ids' => 'optional list<uint>', 16 + 'revisonIDs' => 'optional list<uint>', 17 17 ); 18 18 } 19 19 ··· 27 27 28 28 protected function execute(ConduitAPIRequest $request) { 29 29 $ids = $request->getValue('ids', array()); 30 - $revision_ids = $request->getValue('revision_ids', array()); 30 + $revision_ids = $request->getValue('revisionIDs', array()); 31 31 $diffs = array(); 32 32 $diff_dicts = array(); 33 33 if ($ids || $revision_ids) {