mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 21:10:56 +01:00
Unban releeph product name "branch"
Summary: Fixes T3657. We no longer construct ambiguous URIs, so product names are no longer restricted. Also fix some minor URI construction stuff. Test Plan: Created a product called "branch". Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T3657 Differential Revision: https://secure.phabricator.com/D8767
This commit is contained in:
parent
6deab24475
commit
05e30a024d
4 changed files with 13 additions and 28 deletions
|
@ -58,7 +58,7 @@ final class PhabricatorApplicationReleeph extends PhabricatorApplication {
|
|||
'(?P<action>close|re-open)/(?P<branchID>[1-9]\d*)/' =>
|
||||
'ReleephBranchAccessController',
|
||||
'preview/' => 'ReleephBranchNamePreviewController',
|
||||
'(?P<branchID>[^/]+)/' => array(
|
||||
'(?P<branchID>[1-9]\d*)/' => array(
|
||||
'history/' => 'ReleephBranchHistoryController',
|
||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephBranchViewController',
|
||||
),
|
||||
|
|
|
@ -79,8 +79,10 @@ final class ReleephBranchCreateController extends ReleephProductController {
|
|||
$branch_date,
|
||||
$symbolic_name);
|
||||
|
||||
$branch_uri = $this->getApplicationURI('branch/'.$branch->getID());
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI($branch->getURI());
|
||||
->setURI($branch_uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,13 +86,15 @@ final class ReleephBranchViewController extends ReleephBranchController
|
|||
$crumbs = parent::buildApplicationCrumbs();
|
||||
|
||||
$branch = $this->getBranch();
|
||||
|
||||
$crumbs->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setHref($this->getApplicationURI('branch/pull/'.$branch->getID().'/'))
|
||||
->setName(pht('New Pull Request'))
|
||||
->setIcon('create')
|
||||
->setDisabled(!$branch->isActive()));
|
||||
if ($branch) {
|
||||
$pull_uri = $this->getApplicationURI('branch/pull/'.$branch->getID().'/');
|
||||
$crumbs->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setHref($pull_uri)
|
||||
->setName(pht('New Pull Request'))
|
||||
->setIcon('create')
|
||||
->setDisabled(!$branch->isActive()));
|
||||
}
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
|
|
@ -53,19 +53,6 @@ final class ReleephProject extends ReleephDAO
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function willSaveObject() {
|
||||
// Do this first, to generate the PHID
|
||||
parent::willSaveObject();
|
||||
|
||||
$banned_names = $this->getBannedNames();
|
||||
if (in_array($this->name, $banned_names)) {
|
||||
throw new Exception(sprintf(
|
||||
"The name '%s' is in the list of banned project names!",
|
||||
$this->name,
|
||||
implode(', ', $banned_names)));
|
||||
}
|
||||
}
|
||||
|
||||
public function loadArcanistProject() {
|
||||
return $this->loadOneRelative(
|
||||
new PhabricatorRepositoryArcanistProject(),
|
||||
|
@ -116,12 +103,6 @@ final class ReleephProject extends ReleephDAO
|
|||
return new ReleephDefaultFieldSelector();
|
||||
}
|
||||
|
||||
private function getBannedNames() {
|
||||
return array(
|
||||
'branch', // no one's tried this... yet!
|
||||
);
|
||||
}
|
||||
|
||||
public function isTestFile($filename) {
|
||||
$test_paths = $this->getDetail('testPaths', array());
|
||||
|
||||
|
|
Loading…
Reference in a new issue