Start changing DiffusionCommitController to use identities

Summary: Depends on D19491.

Test Plan: Viewed some commits where the identity was mapped to a user and another that wasn't; saw the header render either a link to the user or the identity object.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19492
This commit is contained in:
Austin McKinley
2018-08-13 14:21:56 -07:00
parent 9a15129b40
commit 3b05e920e0
3 changed files with 87 additions and 24 deletions

View File

@@ -46,6 +46,7 @@ final class DiffusionCommitController extends DiffusionController {
->needCommitData(true)
->needAuditRequests(true)
->setLimit(100)
->needIdentities(true)
->execute();
$multiple_results = count($commits) > 1;
@@ -504,15 +505,13 @@ final class DiffusionCommitController extends DiffusionController {
$phids = $edge_query->getDestinationPHIDs(array($commit_phid));
if ($data->getCommitDetail('authorPHID')) {
$phids[] = $data->getCommitDetail('authorPHID');
}
if ($data->getCommitDetail('reviewerPHID')) {
$phids[] = $data->getCommitDetail('reviewerPHID');
}
if ($data->getCommitDetail('committerPHID')) {
$phids[] = $data->getCommitDetail('committerPHID');
}
$phids[] = $commit->getCommitterDisplayPHID();
$phids[] = $commit->getAuthorDisplayPHID();
// NOTE: We should never normally have more than a single push log, but
// it can occur naturally if a commit is pushed, then the branch it was
@@ -573,24 +572,11 @@ final class DiffusionCommitController extends DiffusionController {
}
}
$author_phid = $data->getCommitDetail('authorPHID');
$author_name = $data->getAuthorName();
$author_epoch = $data->getCommitDetail('authorEpoch');
$committed_info = id(new PHUIStatusItemView())
->setNote(phabricator_datetime($commit->getEpoch(), $viewer));
$committer_phid = $data->getCommitDetail('committerPHID');
$committer_name = $data->getCommitDetail('committer');
if ($committer_phid) {
$committed_info->setTarget($handles[$committer_phid]->renderLink());
} else if (strlen($committer_name)) {
$committed_info->setTarget($committer_name);
} else if ($author_phid) {
$committed_info->setTarget($handles[$author_phid]->renderLink());
} else if (strlen($author_name)) {
$committed_info->setTarget($author_name);
}
->setNote(phabricator_datetime($commit->getEpoch(), $viewer))
->setTarget($commit->renderAnyCommitter($viewer, $handles));
$committed_list = new PHUIStatusListView();
$committed_list->addItem($committed_info);
@@ -716,7 +702,7 @@ final class DiffusionCommitController extends DiffusionController {
return null;
}
$author_phid = $data->getCommitDetail('authorPHID');
$author_phid = $commit->getAuthorDisplayPHID();
$author_name = $data->getAuthorName();
$author_epoch = $data->getCommitDetail('authorEpoch');
$date = null;
@@ -748,10 +734,8 @@ final class DiffusionCommitController extends DiffusionController {
->setImage($image_uri)
->setImageHref($image_href)
->setContent($content);
}
private function buildComments(PhabricatorRepositoryCommit $commit) {
$timeline = $this->buildTransactionTimeline(
$commit,