mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Add "diffusion.commit.edit", a v3 edit API endpoint for commits
Summary: Ref T10978. This currently does almost nothing, but gets it in place so I can add stuff to it. Test Plan: Made a comment on a commit using the API. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10978 Differential Revision: https://secure.phabricator.com/D17178
This commit is contained in:
parent
279273dc1c
commit
2941b34acb
3 changed files with 32 additions and 1 deletions
|
@ -623,6 +623,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionCommitDiffContentHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffContentHeraldField.php',
|
'DiffusionCommitDiffContentHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffContentHeraldField.php',
|
||||||
'DiffusionCommitDiffContentRemovedHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffContentRemovedHeraldField.php',
|
'DiffusionCommitDiffContentRemovedHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffContentRemovedHeraldField.php',
|
||||||
'DiffusionCommitDiffEnormousHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffEnormousHeraldField.php',
|
'DiffusionCommitDiffEnormousHeraldField' => 'applications/diffusion/herald/DiffusionCommitDiffEnormousHeraldField.php',
|
||||||
|
'DiffusionCommitEditConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionCommitEditConduitAPIMethod.php',
|
||||||
'DiffusionCommitEditController' => 'applications/diffusion/controller/DiffusionCommitEditController.php',
|
'DiffusionCommitEditController' => 'applications/diffusion/controller/DiffusionCommitEditController.php',
|
||||||
'DiffusionCommitEditEngine' => 'applications/diffusion/editor/DiffusionCommitEditEngine.php',
|
'DiffusionCommitEditEngine' => 'applications/diffusion/editor/DiffusionCommitEditEngine.php',
|
||||||
'DiffusionCommitFulltextEngine' => 'applications/repository/search/DiffusionCommitFulltextEngine.php',
|
'DiffusionCommitFulltextEngine' => 'applications/repository/search/DiffusionCommitFulltextEngine.php',
|
||||||
|
@ -5316,6 +5317,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionCommitDiffContentHeraldField' => 'DiffusionCommitHeraldField',
|
'DiffusionCommitDiffContentHeraldField' => 'DiffusionCommitHeraldField',
|
||||||
'DiffusionCommitDiffContentRemovedHeraldField' => 'DiffusionCommitHeraldField',
|
'DiffusionCommitDiffContentRemovedHeraldField' => 'DiffusionCommitHeraldField',
|
||||||
'DiffusionCommitDiffEnormousHeraldField' => 'DiffusionCommitHeraldField',
|
'DiffusionCommitDiffEnormousHeraldField' => 'DiffusionCommitHeraldField',
|
||||||
|
'DiffusionCommitEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
||||||
'DiffusionCommitEditController' => 'DiffusionController',
|
'DiffusionCommitEditController' => 'DiffusionController',
|
||||||
'DiffusionCommitEditEngine' => 'PhabricatorEditEngine',
|
'DiffusionCommitEditEngine' => 'PhabricatorEditEngine',
|
||||||
'DiffusionCommitFulltextEngine' => 'PhabricatorFulltextEngine',
|
'DiffusionCommitFulltextEngine' => 'PhabricatorFulltextEngine',
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionCommitEditConduitAPIMethod
|
||||||
|
extends PhabricatorEditEngineAPIMethod {
|
||||||
|
|
||||||
|
public function getAPIMethodName() {
|
||||||
|
return 'diffusion.commit.edit';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newEditEngine() {
|
||||||
|
return new DiffusionCommitEditEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMethodSummary() {
|
||||||
|
return pht(
|
||||||
|
'Apply transactions to edit an existing commit. This method can not '.
|
||||||
|
'create new commits.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,7 +26,16 @@ final class DiffusionCommitEditEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function newEditableObject() {
|
protected function newEditableObject() {
|
||||||
throw new PhutilMethodNotImplementedException();
|
// NOTE: We must return a valid object here so that things like Conduit
|
||||||
|
// documentation generation work. You can't actually create commits via
|
||||||
|
// EditEngine. This is enforced with a "No One" creation policy.
|
||||||
|
|
||||||
|
$repository = new PhabricatorRepository();
|
||||||
|
$data = new PhabricatorRepositoryCommitData();
|
||||||
|
|
||||||
|
return id(new PhabricatorRepositoryCommit())
|
||||||
|
->attachRepository($repository)
|
||||||
|
->attachCommitData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function newObjectQuery() {
|
protected function newObjectQuery() {
|
||||||
|
|
Loading…
Reference in a new issue