mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +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*)/' =>
|
'(?P<action>close|re-open)/(?P<branchID>[1-9]\d*)/' =>
|
||||||
'ReleephBranchAccessController',
|
'ReleephBranchAccessController',
|
||||||
'preview/' => 'ReleephBranchNamePreviewController',
|
'preview/' => 'ReleephBranchNamePreviewController',
|
||||||
'(?P<branchID>[^/]+)/' => array(
|
'(?P<branchID>[1-9]\d*)/' => array(
|
||||||
'history/' => 'ReleephBranchHistoryController',
|
'history/' => 'ReleephBranchHistoryController',
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephBranchViewController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'ReleephBranchViewController',
|
||||||
),
|
),
|
||||||
|
|
|
@ -79,8 +79,10 @@ final class ReleephBranchCreateController extends ReleephProductController {
|
||||||
$branch_date,
|
$branch_date,
|
||||||
$symbolic_name);
|
$symbolic_name);
|
||||||
|
|
||||||
|
$branch_uri = $this->getApplicationURI('branch/'.$branch->getID());
|
||||||
|
|
||||||
return id(new AphrontRedirectResponse())
|
return id(new AphrontRedirectResponse())
|
||||||
->setURI($branch->getURI());
|
->setURI($branch_uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,13 +86,15 @@ final class ReleephBranchViewController extends ReleephBranchController
|
||||||
$crumbs = parent::buildApplicationCrumbs();
|
$crumbs = parent::buildApplicationCrumbs();
|
||||||
|
|
||||||
$branch = $this->getBranch();
|
$branch = $this->getBranch();
|
||||||
|
if ($branch) {
|
||||||
$crumbs->addAction(
|
$pull_uri = $this->getApplicationURI('branch/pull/'.$branch->getID().'/');
|
||||||
id(new PHUIListItemView())
|
$crumbs->addAction(
|
||||||
->setHref($this->getApplicationURI('branch/pull/'.$branch->getID().'/'))
|
id(new PHUIListItemView())
|
||||||
->setName(pht('New Pull Request'))
|
->setHref($pull_uri)
|
||||||
->setIcon('create')
|
->setName(pht('New Pull Request'))
|
||||||
->setDisabled(!$branch->isActive()));
|
->setIcon('create')
|
||||||
|
->setDisabled(!$branch->isActive()));
|
||||||
|
}
|
||||||
|
|
||||||
return $crumbs;
|
return $crumbs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,19 +53,6 @@ final class ReleephProject extends ReleephDAO
|
||||||
return $this;
|
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() {
|
public function loadArcanistProject() {
|
||||||
return $this->loadOneRelative(
|
return $this->loadOneRelative(
|
||||||
new PhabricatorRepositoryArcanistProject(),
|
new PhabricatorRepositoryArcanistProject(),
|
||||||
|
@ -116,12 +103,6 @@ final class ReleephProject extends ReleephDAO
|
||||||
return new ReleephDefaultFieldSelector();
|
return new ReleephDefaultFieldSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBannedNames() {
|
|
||||||
return array(
|
|
||||||
'branch', // no one's tried this... yet!
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isTestFile($filename) {
|
public function isTestFile($filename) {
|
||||||
$test_paths = $this->getDetail('testPaths', array());
|
$test_paths = $this->getDetail('testPaths', array());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue