mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-03 07:59:15 +01:00
Summary: See PHI775. See D19499. Originally, see PHI720. D19499 broke the standalone "Branches" page for commits. Normally, you reach this by taking these steps: - View a commit which is contained by 11 or more branches. - Click the "More Branches..." link in the "Branches" field. - You should be taken to a list of all branches which contain the commit. The change to the 'branch' parameter was adjusted in the query that builds the "x, y, z, More Branches..." list, but not on the actual "Branches" list with the full list. Adjust it. Test Plan: - Set display limit to 1, viewed a commit on "master" and "stable", clicked "More Branches". - Before: saw only "master". - After: saw both "master" and "stable". Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D19532
100 lines
2.5 KiB
PHP
100 lines
2.5 KiB
PHP
<?php
|
|
|
|
final class DiffusionBranchTableController extends DiffusionController {
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
$response = $this->loadDiffusionContext();
|
|
if ($response) {
|
|
return $response;
|
|
}
|
|
|
|
$viewer = $this->getViewer();
|
|
$drequest = $this->getDiffusionRequest();
|
|
$repository = $drequest->getRepository();
|
|
|
|
$pager = id(new PHUIPagerView())
|
|
->readFromRequest($request);
|
|
|
|
$params = array(
|
|
'offset' => $pager->getOffset(),
|
|
'limit' => $pager->getPageSize() + 1,
|
|
'branch' => null,
|
|
);
|
|
|
|
$contains = $drequest->getSymbolicCommit();
|
|
if (strlen($contains)) {
|
|
$params['contains'] = $contains;
|
|
}
|
|
|
|
$branches = $this->callConduitWithDiffusionRequest(
|
|
'diffusion.branchquery',
|
|
$params);
|
|
$branches = $pager->sliceResults($branches);
|
|
|
|
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
|
|
|
|
$content = null;
|
|
if (!$branches) {
|
|
$content = $this->renderStatusMessage(
|
|
pht('No Branches'),
|
|
pht('This repository has no branches.'));
|
|
} else {
|
|
$commits = id(new DiffusionCommitQuery())
|
|
->setViewer($viewer)
|
|
->withIdentifiers(mpull($branches, 'getCommitIdentifier'))
|
|
->withRepository($repository)
|
|
->execute();
|
|
|
|
$list = id(new DiffusionBranchListView())
|
|
->setUser($viewer)
|
|
->setBranches($branches)
|
|
->setCommits($commits)
|
|
->setDiffusionRequest($drequest);
|
|
|
|
$content = id(new PHUIObjectBoxView())
|
|
->setHeaderText($repository->getName())
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
->addClass('diffusion-mobile-view')
|
|
->setTable($list)
|
|
->setPager($pager);
|
|
}
|
|
|
|
$crumbs = $this->buildCrumbs(
|
|
array(
|
|
'branches' => true,
|
|
));
|
|
$crumbs->setBorder(true);
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
->setHeader(pht('Branches'))
|
|
->setHeaderIcon('fa-code-fork');
|
|
|
|
if (!$repository->isSVN()) {
|
|
$branch_tag = $this->renderBranchTag($drequest);
|
|
$header->addTag($branch_tag);
|
|
}
|
|
|
|
$tabs = $this->buildTabsView('branch');
|
|
|
|
$view = id(new PHUITwoColumnView())
|
|
->setHeader($header)
|
|
->setTabs($tabs)
|
|
->setFooter(array(
|
|
$content,
|
|
));
|
|
|
|
return $this->newPage()
|
|
->setTitle(
|
|
array(
|
|
pht('Branches'),
|
|
$repository->getDisplayName(),
|
|
))
|
|
->setCrumbs($crumbs)
|
|
->appendChild($view);
|
|
}
|
|
|
|
}
|