Page MenuHomePhabricator

D17177.id41314.diff
No OneTemporary

D17177.id41314.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -625,7 +625,6 @@
'DiffusionCommitDiffEnormousHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffEnormousHeraldField.php',
'DiffusionCommitEditController' => 'applications/diffusion/controller/DiffusionCommitEditController.php',
'DiffusionCommitEditEngine' => 'applications/diffusion/editor/DiffusionCommitEditEngine.php',
- 'DiffusionCommitEditProController' => 'applications/diffusion/controller/DiffusionCommitEditProController.php',
'DiffusionCommitFulltextEngine' => 'applications/repository/search/DiffusionCommitFulltextEngine.php',
'DiffusionCommitHasRevisionEdgeType' => 'applications/diffusion/edge/DiffusionCommitHasRevisionEdgeType.php',
'DiffusionCommitHasRevisionRelationship' => 'applications/diffusion/relationships/DiffusionCommitHasRevisionRelationship.php',
@@ -5319,7 +5318,6 @@
'DiffusionCommitDiffEnormousHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitEditController' => 'DiffusionController',
'DiffusionCommitEditEngine' => 'PhabricatorEditEngine',
- 'DiffusionCommitEditProController' => 'DiffusionController',
'DiffusionCommitFulltextEngine' => 'PhabricatorFulltextEngine',
'DiffusionCommitHasRevisionEdgeType' => 'PhabricatorEdgeType',
'DiffusionCommitHasRevisionRelationship' => 'DiffusionCommitRelationship',
diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
--- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
+++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
@@ -63,8 +63,6 @@
=> 'DiffusionCommitBranchesController',
'commit/(?P<commit>[a-z0-9]+)/tags/'
=> 'DiffusionCommitTagsController',
- 'commit/(?P<commit>[a-z0-9]+)/edit/'
- => 'DiffusionCommitEditController',
'compare/' => 'DiffusionCompareController',
'manage/(?:(?P<panel>[^/]+)/)?'
=> 'DiffusionRepositoryManagePanelsController',
@@ -134,7 +132,7 @@
'commit/' => array(
$this->getEditRoutePattern('edit/') =>
- 'DiffusionCommitEditProController',
+ 'DiffusionCommitEditController',
),
),
);
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -997,12 +997,12 @@
$commit,
PhabricatorPolicyCapability::CAN_EDIT);
- $identifier = $commit->getCommitIdentifier();
- $uri = $repository->getPathURI("commit/{$identifier}/edit/");
+ $id = $commit->getID();
+ $edit_uri = $this->getApplicationURI("/commit/edit/{$id}/");
$action = id(new PhabricatorActionView())
->setName(pht('Edit Commit'))
- ->setHref($uri)
+ ->setHref($edit_uri)
->setIcon('fa-pencil')
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit);
diff --git a/src/applications/diffusion/controller/DiffusionCommitEditController.php b/src/applications/diffusion/controller/DiffusionCommitEditController.php
--- a/src/applications/diffusion/controller/DiffusionCommitEditController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitEditController.php
@@ -1,120 +1,12 @@
<?php
-final class DiffusionCommitEditController extends DiffusionController {
+final class DiffusionCommitEditController
+ extends DiffusionController {
public function handleRequest(AphrontRequest $request) {
- $response = $this->loadDiffusionContext();
- if ($response) {
- return $response;
- }
-
- $viewer = $this->getViewer();
- $drequest = $this->getDiffusionRequest();
- $repository = $drequest->getRepository();
- $commit = $drequest->loadCommit();
-
- if (!$commit) {
- return new Aphront404Response();
- }
-
- $data = $commit->loadCommitData();
- $page_title = pht('Edit Diffusion Commit');
-
- $commit_phid = $commit->getPHID();
- $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
- $current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
- $commit_phid,
- $edge_type);
-
- if ($request->isFormPost()) {
- $xactions = array();
- $proj_phids = $request->getArr('projects');
- $xactions[] = id(new PhabricatorAuditTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
- ->setMetadataValue('edge:type', $edge_type)
- ->setNewValue(array('=' => array_fuse($proj_phids)));
-
- $editor = id(new PhabricatorAuditEditor())
- ->setActor($viewer)
- ->setContinueOnNoEffect(true)
- ->setContentSourceFromRequest($request);
-
- $editor->applyTransactions($commit, $xactions);
-
- return id(new AphrontRedirectResponse())
- ->setURI($commit->getURI());
- }
-
- $tokenizer_id = celerity_generate_unique_node_id();
- $form = id(new AphrontFormView())
- ->setUser($viewer)
- ->setAction($request->getRequestURI()->getPath())
- ->appendControl(
- id(new AphrontFormTokenizerControl())
- ->setLabel(pht('Projects'))
- ->setName('projects')
- ->setValue($current_proj_phids)
- ->setID($tokenizer_id)
- ->setDatasource(new PhabricatorProjectDatasource()));
-
- $reason = $data->getCommitDetail('autocloseReason', false);
- $reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
- if ($reason !== false) {
- switch ($reason) {
- case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
- $desc = pht('No, Repository Importing');
- break;
- case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
- $desc = pht('No, Autoclose Disabled');
- break;
- case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
- $desc = pht('No, Not On Autoclose Branch');
- break;
- case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
- $desc = pht('Yes, Forced Via bin/repository CLI Tool.');
- break;
- case null:
- $desc = pht('Yes');
- break;
- default:
- $desc = pht('Unknown');
- break;
- }
-
- $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
- $doc_link = phutil_tag(
- 'a',
- array(
- 'href' => $doc_href,
- 'target' => '_blank',
- ),
- pht('Learn More'));
-
- $form->appendChild(
- id(new AphrontFormMarkupControl())
- ->setLabel(pht('Autoclose?'))
- ->setValue(array($desc, " \xC2\xB7 ", $doc_link)));
- }
-
- $form->appendControl(
- id(new AphrontFormSubmitControl())
- ->setValue(pht('Save'))
- ->addCancelButton($commit->getURI()));
-
- $crumbs = $this->buildCrumbs(
- array(
- 'commit' => true,
- ));
- $crumbs->addTextCrumb(pht('Edit'));
-
- $form_box = id(new PHUIObjectBoxView())
- ->setHeaderText($page_title)
- ->setForm($form);
-
- return $this->newPage()
- ->setTitle($page_title)
- ->setCrumbs($crumbs)
- ->appendChild($form_box);
+ return id(new DiffusionCommitEditEngine())
+ ->setController($this)
+ ->buildResponse();
}
}
diff --git a/src/applications/diffusion/controller/DiffusionCommitEditProController.php b/src/applications/diffusion/controller/DiffusionCommitEditProController.php
deleted file mode 100644
--- a/src/applications/diffusion/controller/DiffusionCommitEditProController.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-final class DiffusionCommitEditProController
- extends DiffusionController {
-
- public function handleRequest(AphrontRequest $request) {
- return id(new DiffusionCommitEditEngine())
- ->setController($this)
- ->buildResponse();
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 29, 5:05 PM (5 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223737
Default Alt Text
D17177.id41314.diff (7 KB)

Event Timeline