1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 16:00:59 +01:00

Bring very basic EditEngine support to commits

Summary:
Ref T10978. After T11114, we have some features (like the old code for the haunted comment panel) which are only used by Diffusion. I want to modernize it so I can nuke them. T10978 also describes many bugs which are only fixable after modernizing.

This adds very basic EditEngine support for commits/audit. You can't create new commits with this workflow, just tag/update existing ones.

Test Plan: {F2340347}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10978

Differential Revision: https://secure.phabricator.com/D17175
This commit is contained in:
epriestley 2017-01-11 08:23:19 -08:00
parent 452f5bce18
commit 7ff0be1bde
4 changed files with 91 additions and 0 deletions

View file

@ -624,6 +624,8 @@ phutil_register_library_map(array(
'DiffusionCommitDiffContentRemovedHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffContentRemovedHeraldField.php',
'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',
@ -5316,6 +5318,8 @@ phutil_register_library_map(array(
'DiffusionCommitDiffContentRemovedHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitDiffEnormousHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitEditController' => 'DiffusionController',
'DiffusionCommitEditEngine' => 'PhabricatorEditEngine',
'DiffusionCommitEditProController' => 'DiffusionController',
'DiffusionCommitFulltextEngine' => 'PhabricatorFulltextEngine',
'DiffusionCommitHasRevisionEdgeType' => 'PhabricatorEdgeType',
'DiffusionCommitHasRevisionRelationship' => 'DiffusionCommitRelationship',

View file

@ -131,6 +131,11 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
'symbol/(?P<name>[^/]+)/' => 'DiffusionSymbolController',
'external/' => 'DiffusionExternalController',
'lint/' => 'DiffusionLintController',
'commit/' => array(
$this->getEditRoutePattern('edit/') =>
'DiffusionCommitEditProController',
),
),
);
}

View file

@ -0,0 +1,12 @@
<?php
final class DiffusionCommitEditProController
extends DiffusionController {
public function handleRequest(AphrontRequest $request) {
return id(new DiffusionCommitEditEngine())
->setController($this)
->buildResponse();
}
}

View file

@ -0,0 +1,70 @@
<?php
final class DiffusionCommitEditEngine
extends PhabricatorEditEngine {
const ENGINECONST = 'diffusion.commit';
public function isEngineConfigurable() {
return false;
}
public function getEngineName() {
return pht('Commits');
}
public function getSummaryHeader() {
return pht('Edit Commits');
}
public function getSummaryText() {
return pht('Edit commits.');
}
public function getEngineApplicationClass() {
return 'PhabricatorDiffusionApplication';
}
protected function newEditableObject() {
throw new PhutilMethodNotImplementedException();
}
protected function newObjectQuery() {
return new DiffusionCommitQuery();
}
protected function getObjectCreateTitleText($object) {
return pht('Create Commit');
}
protected function getObjectCreateShortText() {
return pht('Create Commit');
}
protected function getObjectEditTitleText($object) {
return pht('Edit Commit: %s', $object->getDisplayName());
}
protected function getObjectEditShortText($object) {
return $object->getDisplayName();
}
protected function getObjectName() {
return pht('Commit');
}
protected function getObjectViewURI($object) {
return $object->getURI();
}
protected function getCreateNewObjectPolicy() {
return PhabricatorPolicies::POLICY_NOONE;
}
protected function buildCustomEditFields($object) {
$viewer = $this->getViewer();
return array();
}
}