diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 6527f5a0fd..7ce8fb0608 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -88,6 +88,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_parsecommitmessage_Method' => 'applications/conduit/method/differential/parsecommitmessage', 'ConduitAPI_differential_setdiffproperty_Method' => 'applications/conduit/method/differential/setdiffproperty', 'ConduitAPI_differential_updaterevision_Method' => 'applications/conduit/method/differential/updaterevision', + 'ConduitAPI_differential_updatetaskrevisionassoc_Method' => 'applications/conduit/method/differential/updatetaskrevisionassoc', 'ConduitAPI_diffusion_getcommits_Method' => 'applications/conduit/method/diffusion/getcommits', 'ConduitAPI_file_upload_Method' => 'applications/conduit/method/file/upload', 'ConduitAPI_path_getowners_Method' => 'applications/conduit/method/path/getowners', @@ -539,6 +540,7 @@ phutil_register_library_map(array( 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_updaterevision_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_updatetaskrevisionassoc_Method' => 'ConduitAPIMethod', 'ConduitAPI_diffusion_getcommits_Method' => 'ConduitAPIMethod', 'ConduitAPI_file_upload_Method' => 'ConduitAPIMethod', 'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod', diff --git a/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php index 4bee4284c5..4ffb6087fb 100644 --- a/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php @@ -83,7 +83,7 @@ class PhabricatorConduitConsoleController id(new AphrontFormTextControl()) ->setLabel($param) ->setName("params[{$param}]") - ->setCaption($desc)); + ->setCaption(phutil_escape_html($desc))); } $form diff --git a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php index fc4b986f1e..4cc284b0ce 100644 --- a/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php +++ b/src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php @@ -34,7 +34,7 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { return array( 'query' => 'required enum<'.$types.'>', - 'guids' => 'required nonempty list', + 'guids' => 'required nonempty list', ); } @@ -49,11 +49,11 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { protected function execute(ConduitAPIRequest $request) { $query = $request->getValue('query'); - $phids = $request->getValue('guids'); + $guids = $request->getValue('guids'); $revisions = id(new DifferentialRevisionListData( $query, - (array)$phids)) + (array)$guids)) ->loadRevisions(); $results = array(); @@ -64,6 +64,7 @@ class ConduitAPI_differential_find_Method extends ConduitAPIMethod { } $results[] = array( 'id' => $revision->getID(), + 'phid' => $revision->getPHID(), 'name' => $revision->getTitle(), 'statusName' => DifferentialRevisionStatus::getNameForRevisionStatus( $revision->getStatus()), diff --git a/src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php b/src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php new file mode 100644 index 0000000000..45a3a6829b --- /dev/null +++ b/src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php @@ -0,0 +1,71 @@ + 'required nonempty string', + 'orig_rev_phids' => 'required list', + 'new_rev_phids' => 'required list', + ); + } + + public function defineReturnType() { + return 'void'; + } + + public function defineErrorTypes() { + return array( + 'ERR_NO_TASKATTACHER_DEFINED' => 'No task attacher defined.', + ); + } + + protected function execute(ConduitAPIRequest $request) { + $task_phid = $request->getValue('task_phid'); + $orig_rev_phids = $request->getValue('orig_rev_phids'); + if (empty($orig_rev_phids)) { + $orig_rev_phids = array(); + } + + $new_rev_phids = $request->getValue('new_rev_phids'); + if (empty($new_rev_phids)) { + $new_rev_phids = array(); + } + + $task_class = PhabricatorEnv::getEnvConfig( + 'differential.attach-task-class'); + if (!$task_class) { + throw new ConduitException('ERR_NO_TASKATTACHER_DEFINED'); + } + + PhutilSymbolLoader::loadClass($task_class); + $task_attacher = newv($task_class, array()); + $task_attacher->updateTaskRevisionAssoc( + $task_phid, + $orig_rev_phids, + $new_rev_phids); + } + +} + diff --git a/src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php b/src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php new file mode 100644 index 0000000000..0ad02cea4f --- /dev/null +++ b/src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php @@ -0,0 +1,17 @@ +