mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Update DiffusionLastModifiedController to use identities
Summary: Ref T12164. Updates another controller to use identities. Test Plan: Pretty ad-hoc, but loaded the main pages of several different repos with and without repo identities. I'm not totally convinced the `author` from this data structure is actually being used: ``` $return = array( 'commit' => $modified, 'date' => $date, 'author' => $author, 'details' => $details, ); ``` Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12164 Differential Revision: https://secure.phabricator.com/D19580
This commit is contained in:
parent
438edde031
commit
5c4c593af3
4 changed files with 21 additions and 39 deletions
|
@ -24,6 +24,7 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withRepository($repository)
|
->withRepository($repository)
|
||||||
->withIdentifiers($identifiers)
|
->withIdentifiers($identifiers)
|
||||||
|
->needIdentities(true)
|
||||||
->execute();
|
->execute();
|
||||||
$commits = mpull($commits, null, 'getCommitIdentifier');
|
$commits = mpull($commits, null, 'getCommitIdentifier');
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,10 +69,7 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
|
|
||||||
$handle_phids = array();
|
$handle_phids = array();
|
||||||
foreach ($commits as $commit) {
|
foreach ($commits as $commit) {
|
||||||
$author_phid = $commit->getAuthorPHID();
|
$handle_phids[] = $commit->getAuthorDisplayPHID();
|
||||||
if ($author_phid) {
|
|
||||||
$handle_phids[] = $author_phid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($revisions as $revision) {
|
foreach ($revisions as $revision) {
|
||||||
|
@ -117,7 +115,7 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
$author_phid = null;
|
$author_phid = null;
|
||||||
|
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
$author_phid = $commit->getAuthorPHID();
|
$author_phid = $commit->getAuthorDisplayPHID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$author_phid && $revision) {
|
if (!$author_phid && $revision) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ final class DiffusionLastModifiedController extends DiffusionController {
|
||||||
->withRepository($drequest->getRepository())
|
->withRepository($drequest->getRepository())
|
||||||
->withIdentifiers(array_values($modified_map))
|
->withIdentifiers(array_values($modified_map))
|
||||||
->needCommitData(true)
|
->needCommitData(true)
|
||||||
|
->needIdentities(true)
|
||||||
->execute();
|
->execute();
|
||||||
$commit_map = mpull($commit_map, null, 'getCommitIdentifier');
|
$commit_map = mpull($commit_map, null, 'getCommitIdentifier');
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,9 +55,8 @@ final class DiffusionLastModifiedController extends DiffusionController {
|
||||||
|
|
||||||
$phids = array();
|
$phids = array();
|
||||||
foreach ($commits as $commit) {
|
foreach ($commits as $commit) {
|
||||||
$data = $commit->getCommitData();
|
$phids[] = $commit->getCommitterDisplayPHID();
|
||||||
$phids[] = $data->getCommitDetail('authorPHID');
|
$phids[] = $commit->getAuthorDisplayPHID();
|
||||||
$phids[] = $data->getCommitDetail('committerPHID');
|
|
||||||
}
|
}
|
||||||
$phids = array_filter($phids);
|
$phids = array_filter($phids);
|
||||||
$handles = $this->loadViewerHandles($phids);
|
$handles = $this->loadViewerHandles($phids);
|
||||||
|
@ -110,37 +110,20 @@ final class DiffusionLastModifiedController extends DiffusionController {
|
||||||
$date = '';
|
$date = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $commit->getCommitData();
|
$author = $commit->renderAuthor($viewer, $handles);
|
||||||
if ($data) {
|
$committer = $commit->renderCommitter($viewer, $handles);
|
||||||
$author_phid = $data->getCommitDetail('authorPHID');
|
|
||||||
if ($author_phid && isset($handles[$author_phid])) {
|
|
||||||
$author = $handles[$author_phid]->renderLink();
|
|
||||||
} else {
|
|
||||||
$author = DiffusionView::renderName($data->getAuthorName());
|
|
||||||
}
|
|
||||||
|
|
||||||
$committer = $data->getCommitDetail('committer');
|
|
||||||
if ($committer) {
|
|
||||||
$committer_phid = $data->getCommitDetail('committerPHID');
|
|
||||||
if ($committer_phid && isset($handles[$committer_phid])) {
|
|
||||||
$committer = $handles[$committer_phid]->renderLink();
|
|
||||||
} else {
|
|
||||||
$committer = DiffusionView::renderName($committer);
|
|
||||||
}
|
|
||||||
if ($author != $committer) {
|
if ($author != $committer) {
|
||||||
$author = hsprintf('%s/%s', $author, $committer);
|
$author = hsprintf('%s/%s', $author, $committer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
$data = $commit->getCommitData();
|
||||||
$details = DiffusionView::linkDetail(
|
$details = DiffusionView::linkDetail(
|
||||||
$drequest->getRepository(),
|
$drequest->getRepository(),
|
||||||
$commit->getCommitIdentifier(),
|
$commit->getCommitIdentifier(),
|
||||||
$data->getSummary());
|
$data->getSummary());
|
||||||
$details = AphrontTableView::renderSingleDisplayLine($details);
|
$details = AphrontTableView::renderSingleDisplayLine($details);
|
||||||
} else {
|
|
||||||
$author = '';
|
|
||||||
$details = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'commit' => $modified,
|
'commit' => $modified,
|
||||||
|
|
|
@ -39,6 +39,7 @@ final class PhabricatorRepositoryIdentityPHIDType
|
||||||
$handle->setObjectName(pht('Identity %d', $id));
|
$handle->setObjectName(pht('Identity %d', $id));
|
||||||
$handle->setName($name);
|
$handle->setName($name);
|
||||||
$handle->setURI($identity->getURI());
|
$handle->setURI($identity->getURI());
|
||||||
|
$handle->setIcon('fa-user');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,7 @@ final class PhabricatorRepositoryCommit
|
||||||
$data = $this->getCommitData();
|
$data = $this->getCommitData();
|
||||||
$committer_name = $data->getCommitDetail('committer');
|
$committer_name = $data->getCommitDetail('committer');
|
||||||
if (strlen($committer_name)) {
|
if (strlen($committer_name)) {
|
||||||
return $committer_name;
|
return DiffusionView::renderName($committer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -479,7 +479,7 @@ final class PhabricatorRepositoryCommit
|
||||||
$data = $this->getCommitData();
|
$data = $this->getCommitData();
|
||||||
$author_name = $data->getAuthorName();
|
$author_name = $data->getAuthorName();
|
||||||
if (strlen($author_name)) {
|
if (strlen($author_name)) {
|
||||||
return $author_name;
|
return DiffusionView::renderName($author_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue