1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Fix error in D5634

Summary:
The original code seemed to assume the last level of edges was the destination edge, when it was an array under the destination edge key.
Using `array_keys` fixes the crashes that resulted when commits had tasks, projects or revisions attached.

Test Plan: Open up a commit with a revision attached.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, vrana

Differential Revision: https://secure.phabricator.com/D5698
This commit is contained in:
Juan Pablo Civile 2013-04-15 08:41:41 -07:00 committed by epriestley
parent bd350abbe9
commit 141228343c

View file

@ -360,14 +360,15 @@ final class DiffusionCommitController extends DiffusionController {
$user = $this->getRequest()->getUser();
$commit_phid = $commit->getPHID();
$edges = id(new PhabricatorEdgeQuery())
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($commit_phid))
->withEdgeTypes(array(
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK,
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT,
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV,
))
->execute();
));
$edges = $edge_query->execute();
$task_phids = array_keys(
$edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK]);
@ -376,7 +377,8 @@ final class DiffusionCommitController extends DiffusionController {
$revision_phid = key(
$edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV]);
$phids = array_mergev($edges[$commit_phid]);
$phids = $edge_query->getDestinationPHIDs(array($commit_phid));
if ($data->getCommitDetail('authorPHID')) {
$phids[] = $data->getCommitDetail('authorPHID');
}