Policy - remove loadRepository() method from ArcanistProjects
Summary: Ref T7094. This loadRepository() method bypassed policy unnecessarily. kill it. Test Plan: basically un-tested since arcanist projects are deprecated and the main callsites were in releeph. conduit end point still works though! Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7094 Differential Revision: https://secure.phabricator.com/D11586
This commit is contained in:
@@ -38,7 +38,13 @@ final class ArcanistProjectInfoConduitAPIMethod
|
|||||||
throw new ConduitException('ERR-BAD-ARCANIST-PROJECT');
|
throw new ConduitException('ERR-BAD-ARCANIST-PROJECT');
|
||||||
}
|
}
|
||||||
|
|
||||||
$repository = $project->loadRepository();
|
$repository = null;
|
||||||
|
if ($project->getRepositoryID()) {
|
||||||
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
|
->setViewer($request->getUser())
|
||||||
|
->withRepositoryIDs(array($project->getRepositoryID()))
|
||||||
|
->executeOne();
|
||||||
|
}
|
||||||
|
|
||||||
$repository_phid = null;
|
$repository_phid = null;
|
||||||
$tracked = false;
|
$tracked = false;
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ final class ReleephBranchNamePreviewController
|
|||||||
|
|
||||||
$arc_project_id = $request->getInt('arcProjectID');
|
$arc_project_id = $request->getInt('arcProjectID');
|
||||||
$fake_commit_handle =
|
$fake_commit_handle =
|
||||||
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id);
|
ReleephBranchTemplate::getFakeCommitHandleFor(
|
||||||
|
$arc_project_id,
|
||||||
|
$request->getUser());
|
||||||
|
|
||||||
list($name, $errors) = id(new ReleephBranchTemplate())
|
list($name, $errors) = id(new ReleephBranchTemplate())
|
||||||
->setCommitHandle($fake_commit_handle)
|
->setCommitHandle($fake_commit_handle)
|
||||||
|
|||||||
@@ -28,7 +28,14 @@ final class ReleephProductCreateController extends ReleephProductController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$arc_project = $arc_projects[$arc_pr_id];
|
$arc_project = $arc_projects[$arc_pr_id];
|
||||||
$pr_repository = $arc_project->loadRepository();
|
$pr_repository = null;
|
||||||
|
if ($arc_project->getRepositoryID()) {
|
||||||
|
$pr_repository = id(new PhabricatorRepositoryQuery())
|
||||||
|
->setViewer($request->getUser())
|
||||||
|
->withRepositoryIDs(array($arc_project->getRepositoryID()))
|
||||||
|
->executeOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
$releeph_product = id(new ReleephProject())
|
$releeph_product = id(new ReleephProject())
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ final class ReleephProductEditController extends ReleephProductController {
|
|||||||
->setDetail('testPaths', $test_paths);
|
->setDetail('testPaths', $test_paths);
|
||||||
|
|
||||||
$fake_commit_handle =
|
$fake_commit_handle =
|
||||||
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id);
|
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id, $viewer);
|
||||||
|
|
||||||
if ($branch_template) {
|
if ($branch_template) {
|
||||||
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
|
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ final class ReleephBranchTemplate {
|
|||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFakeCommitHandleFor($arc_project_id) {
|
public static function getFakeCommitHandleFor(
|
||||||
|
$arc_project_id,
|
||||||
|
PhabricatorUser $viewer) {
|
||||||
|
|
||||||
$arc_project = id(new PhabricatorRepositoryArcanistProject())
|
$arc_project = id(new PhabricatorRepositoryArcanistProject())
|
||||||
->load($arc_project_id);
|
->load($arc_project_id);
|
||||||
if (!$arc_project) {
|
if (!$arc_project) {
|
||||||
@@ -27,9 +30,19 @@ final class ReleephBranchTemplate {
|
|||||||
"No Arc project found with id '{$arc_project_id}'!");
|
"No Arc project found with id '{$arc_project_id}'!");
|
||||||
}
|
}
|
||||||
|
|
||||||
$repository = $arc_project->loadRepository();
|
$repository = null;
|
||||||
return id(new PhabricatorObjectHandle())
|
if ($arc_project->getRepositoryID()) {
|
||||||
->setName($repository->formatCommitName('100000000000'));
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withRepositoryIDs(array($arc_project->getRepositoryID()))
|
||||||
|
->executeOne();
|
||||||
|
}
|
||||||
|
$fake_handle = 'SOFAKE';
|
||||||
|
if ($repository) {
|
||||||
|
$fake_handle = id(new PhabricatorObjectHandle())
|
||||||
|
->setName($repository->formatCommitName('100000000000'));
|
||||||
|
}
|
||||||
|
return $fake_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
private $commitHandle;
|
private $commitHandle;
|
||||||
|
|||||||
@@ -45,14 +45,6 @@ final class PhabricatorRepositoryArcanistProject
|
|||||||
PhabricatorRepositoryArcanistProjectPHIDType::TYPECONST);
|
PhabricatorRepositoryArcanistProjectPHIDType::TYPECONST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove. Also, T603.
|
|
||||||
public function loadRepository() {
|
|
||||||
if (!$this->getRepositoryID()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return id(new PhabricatorRepository())->load($this->getRepositoryID());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function delete() {
|
public function delete() {
|
||||||
$this->openTransaction();
|
$this->openTransaction();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user