mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-28 12:08:14 +01:00
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:
parent
8f1e0c0262
commit
f58dce6819
6 changed files with 36 additions and 16 deletions
|
@ -38,7 +38,13 @@ final class ArcanistProjectInfoConduitAPIMethod
|
|||
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;
|
||||
$tracked = false;
|
||||
|
|
|
@ -15,7 +15,9 @@ final class ReleephBranchNamePreviewController
|
|||
|
||||
$arc_project_id = $request->getInt('arcProjectID');
|
||||
$fake_commit_handle =
|
||||
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id);
|
||||
ReleephBranchTemplate::getFakeCommitHandleFor(
|
||||
$arc_project_id,
|
||||
$request->getUser());
|
||||
|
||||
list($name, $errors) = id(new ReleephBranchTemplate())
|
||||
->setCommitHandle($fake_commit_handle)
|
||||
|
|
|
@ -28,7 +28,14 @@ final class ReleephProductCreateController extends ReleephProductController {
|
|||
}
|
||||
|
||||
$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) {
|
||||
$releeph_product = id(new ReleephProject())
|
||||
|
|
|
@ -93,7 +93,7 @@ final class ReleephProductEditController extends ReleephProductController {
|
|||
->setDetail('testPaths', $test_paths);
|
||||
|
||||
$fake_commit_handle =
|
||||
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id);
|
||||
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id, $viewer);
|
||||
|
||||
if ($branch_template) {
|
||||
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
|
||||
|
|
|
@ -19,7 +19,10 @@ final class ReleephBranchTemplate {
|
|||
return $template;
|
||||
}
|
||||
|
||||
public static function getFakeCommitHandleFor($arc_project_id) {
|
||||
public static function getFakeCommitHandleFor(
|
||||
$arc_project_id,
|
||||
PhabricatorUser $viewer) {
|
||||
|
||||
$arc_project = id(new PhabricatorRepositoryArcanistProject())
|
||||
->load($arc_project_id);
|
||||
if (!$arc_project) {
|
||||
|
@ -27,9 +30,19 @@ final class ReleephBranchTemplate {
|
|||
"No Arc project found with id '{$arc_project_id}'!");
|
||||
}
|
||||
|
||||
$repository = $arc_project->loadRepository();
|
||||
return id(new PhabricatorObjectHandle())
|
||||
->setName($repository->formatCommitName('100000000000'));
|
||||
$repository = null;
|
||||
if ($arc_project->getRepositoryID()) {
|
||||
$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;
|
||||
|
|
|
@ -45,14 +45,6 @@ final class PhabricatorRepositoryArcanistProject
|
|||
PhabricatorRepositoryArcanistProjectPHIDType::TYPECONST);
|
||||
}
|
||||
|
||||
// TODO: Remove. Also, T603.
|
||||
public function loadRepository() {
|
||||
if (!$this->getRepositoryID()) {
|
||||
return null;
|
||||
}
|
||||
return id(new PhabricatorRepository())->load($this->getRepositoryID());
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$this->openTransaction();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue