mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
Clean up Diffusion tag list query a bit
Summary: - Use DiffusionCommitQuery. - Use denormalized summary. - Use stronger "Importing" test. Test Plan: Viewed `/diffusion/X/` for repos with tags. Saw tags; saw importing commits marked as "Importing" instead of "Unknown". Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7452
This commit is contained in:
parent
d1c4b5081c
commit
25656b311a
3 changed files with 25 additions and 23 deletions
|
@ -225,15 +225,15 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
->withRepositoryIDs(array($drequest->getRepository()->getID()))
|
->withRepositoryIDs(array($drequest->getRepository()->getID()))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$table = new DiffusionBranchTableView();
|
$table = id(new DiffusionBranchTableView())
|
||||||
$table->setDiffusionRequest($drequest);
|
->setUser($viewer)
|
||||||
$table->setBranches($branches);
|
->setDiffusionRequest($drequest)
|
||||||
$table->setCommits($commits);
|
->setBranches($branches)
|
||||||
$table->setUser($this->getRequest()->getUser());
|
->setCommits($commits);
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = id(new AphrontPanelView())
|
||||||
$panel->setHeader(pht('Branches'));
|
->setHeader(pht('Branches'))
|
||||||
$panel->setNoBackground();
|
->setNoBackground();
|
||||||
|
|
||||||
if ($more_branches) {
|
if ($more_branches) {
|
||||||
$panel->setCaption(pht('Showing %d branches.', $limit));
|
$panel->setCaption(pht('Showing %d branches.', $limit));
|
||||||
|
@ -257,6 +257,8 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildTagListTable(DiffusionRequest $drequest) {
|
private function buildTagListTable(DiffusionRequest $drequest) {
|
||||||
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
|
||||||
$tag_limit = 15;
|
$tag_limit = 15;
|
||||||
$tags = array();
|
$tags = array();
|
||||||
try {
|
try {
|
||||||
|
@ -281,26 +283,26 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
$more_tags = (count($tags) > $tag_limit);
|
$more_tags = (count($tags) > $tag_limit);
|
||||||
$tags = array_slice($tags, 0, $tag_limit);
|
$tags = array_slice($tags, 0, $tag_limit);
|
||||||
|
|
||||||
$commits = id(new PhabricatorAuditCommitQuery())
|
$commits = id(new DiffusionCommitQuery())
|
||||||
->withIdentifiers(
|
->setViewer($viewer)
|
||||||
$drequest->getRepository()->getID(),
|
->withIdentifiers(mpull($tags, 'getCommitIdentifier'))
|
||||||
mpull($tags, 'getCommitIdentifier'))
|
->withRepositoryIDs(array($drequest->getRepository()->getID()))
|
||||||
->needCommitData(true)
|
->needCommitData(true)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view = new DiffusionTagListView();
|
$view = id(new DiffusionTagListView())
|
||||||
$view->setDiffusionRequest($drequest);
|
->setUser($viewer)
|
||||||
$view->setTags($tags);
|
->setDiffusionRequest($drequest)
|
||||||
$view->setUser($this->getRequest()->getUser());
|
->setTags($tags)
|
||||||
$view->setCommits($commits);
|
->setCommits($commits);
|
||||||
|
|
||||||
$phids = $view->getRequiredHandlePHIDs();
|
$phids = $view->getRequiredHandlePHIDs();
|
||||||
$handles = $this->loadViewerHandles($phids);
|
$handles = $this->loadViewerHandles($phids);
|
||||||
$view->setHandles($handles);
|
$view->setHandles($handles);
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = id(new AphrontPanelView())
|
||||||
$panel->setHeader(pht('Tags'));
|
->setHeader(pht('Tags'))
|
||||||
$panel->setNoBackground(true);
|
->setNoBackground(true);
|
||||||
|
|
||||||
if ($more_tags) {
|
if ($more_tags) {
|
||||||
$panel->setCaption(pht('Showing the %d most recent tags.', $tag_limit));
|
$panel->setCaption(pht('Showing the %d most recent tags.', $tag_limit));
|
||||||
|
|
|
@ -113,7 +113,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$commit = $history->getCommit();
|
$commit = $history->getCommit();
|
||||||
if ($commit && !$commit->getIsUnparsed() && $data) {
|
if ($commit && $commit->isImported() && $data) {
|
||||||
$change = $this->linkChange(
|
$change = $this->linkChange(
|
||||||
$history->getChangeType(),
|
$history->getChangeType(),
|
||||||
$history->getFileType(),
|
$history->getFileType(),
|
||||||
|
|
|
@ -73,8 +73,8 @@ final class DiffusionTagListView extends DiffusionView {
|
||||||
// unique data which isn't otherwise available.
|
// unique data which isn't otherwise available.
|
||||||
$description = $tag->getDescription();
|
$description = $tag->getDescription();
|
||||||
} else {
|
} else {
|
||||||
if ($commit && $commit->getCommitData()) {
|
if ($commit) {
|
||||||
$description = $commit->getCommitData()->getSummary();
|
$description = $commit->getSummary();
|
||||||
} else {
|
} else {
|
||||||
$description = $tag->getDescription();
|
$description = $tag->getDescription();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue