diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ba266c91ed..d1761cbce3 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2718,26 +2718,26 @@ phutil_register_library_map(array( 'ConduitAPI_conpherence_updatethread_Method' => 'ConduitAPI_conpherence_Method', 'ConduitAPI_differential_Method' => 'ConduitAPIMethod', 'ConduitAPI_differential_close_Method' => 'ConduitAPI_differential_Method', - 'ConduitAPI_differential_createcomment_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_creatediff_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_createcomment_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_creatediff_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_createinline_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_createrawdiff_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_createrevision_Method' => 'ConduitAPI_differential_Method', - 'ConduitAPI_differential_find_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_finishpostponedlinters_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_getalldiffs_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_getcommitmessage_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_getcommitpaths_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_getdiff_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_getrawdiff_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_find_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_finishpostponedlinters_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_getalldiffs_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_getcommitmessage_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_getcommitpaths_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_getdiff_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_getrawdiff_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_getrevision_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_getrevisioncomments_Method' => 'ConduitAPI_differential_Method', - 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_query_Method' => 'ConduitAPI_differential_Method', - 'ConduitAPI_differential_querydiffs_Method' => 'ConduitAPIMethod', - 'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_querydiffs_Method' => 'ConduitAPI_differential_Method', + 'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_differential_updaterevision_Method' => 'ConduitAPI_differential_Method', - 'ConduitAPI_differential_updateunitresults_Method' => 'ConduitAPIMethod', + 'ConduitAPI_differential_updateunitresults_Method' => 'ConduitAPI_differential_Method', 'ConduitAPI_diffusion_Method' => 'ConduitAPIMethod', 'ConduitAPI_diffusion_abstractquery_Method' => 'ConduitAPI_diffusion_Method', 'ConduitAPI_diffusion_branchquery_Method' => 'ConduitAPI_diffusion_abstractquery_Method', diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index e6d8d975c3..cc4f752223 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -1,13 +1,14 @@ method = $data['method']; } @@ -26,28 +27,25 @@ final class PhabricatorConduitConsoleController return new Aphront404Response(); } + $can_call_method = false; + $status = $method->getMethodStatus(); $reason = $method->getMethodStatusDescription(); + $errors = array(); - $status_view = null; - if ($status != ConduitAPIMethod::METHOD_STATUS_STABLE) { - $status_view = new AphrontErrorView(); - switch ($status) { - case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: - $status_view->setTitle('Deprecated Method'); - $status_view->appendChild( - nonempty($reason, "This method is deprecated.")); - break; - case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: - $status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING); - $status_view->setTitle('Unstable Method'); - $status_view->appendChild( - nonempty( - $reason, - "This method is new and unstable. Its interface is subject ". - "to change.")); - break; - } + switch ($status) { + case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: + $reason = nonempty($reason, pht('This method is deprecated.')); + $errors[] = pht('Deprecated Method: %s', $reason); + break; + case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: + $reason = nonempty( + $reason, + pht( + 'This method is new and unstable. Its interface is subject '. + 'to change.')); + $errors[] = pht('Unstable Method: %s', $reason); + break; } $error_types = $method->defineErrorTypes(); @@ -61,7 +59,8 @@ final class PhabricatorConduitConsoleController } $error_description = phutil_tag('ul', array(), $error_description); } else { - $error_description = "This method does not raise any specific errors."; + $error_description = pht( + 'This method does not raise any specific errors.'); } $form = new AphrontFormView(); @@ -95,29 +94,38 @@ final class PhabricatorConduitConsoleController ->setCaption($desc)); } - $form - ->appendChild( - id(new AphrontFormSelectControl()) - ->setLabel('Output Format') - ->setName('output') - ->setOptions( - array( - 'human' => 'Human Readable', - 'json' => 'JSON', - ))) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->addCancelButton($this->getApplicationURI()) - ->setValue('Call Method')); + $must_login = !$viewer->isLoggedIn() && + $method->shouldRequireAuthentication(); + if ($must_login) { + $errors[] = pht( + 'Login Required: This method requires authentication. You must '. + 'log in before you can make calls to it.'); + } else { + $form + ->appendChild( + id(new AphrontFormSelectControl()) + ->setLabel('Output Format') + ->setName('output') + ->setOptions( + array( + 'human' => 'Human Readable', + 'json' => 'JSON', + ))) + ->appendChild( + id(new AphrontFormSubmitControl()) + ->addCancelButton($this->getApplicationURI()) + ->setValue(pht('Call Method'))); + } + + $header = id(new PHUIHeaderView()) + ->setUser($viewer) + ->setHeader($method->getAPIMethodName()); $form_box = id(new PHUIObjectBoxView()) - ->setHeaderText($method->getAPIMethodName()) + ->setHeader($header) + ->setFormErrors($errors) ->setForm($form); - if ($status_view) { - $form_box->setErrorView($status_view); - } - $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb($method->getAPIMethodName()); diff --git a/src/applications/conduit/controller/PhabricatorConduitListController.php b/src/applications/conduit/controller/PhabricatorConduitListController.php index fdf46a0fd0..2d8fd2dab2 100644 --- a/src/applications/conduit/controller/PhabricatorConduitListController.php +++ b/src/applications/conduit/controller/PhabricatorConduitListController.php @@ -1,14 +1,15 @@ queryKey = idx($data, 'queryKey'); } diff --git a/src/applications/differential/conduit/ConduitAPI_differential_createcomment_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_createcomment_Method.php index df39032142..726d5171fd 100644 --- a/src/applications/differential/conduit/ConduitAPI_differential_createcomment_Method.php +++ b/src/applications/differential/conduit/ConduitAPI_differential_createcomment_Method.php @@ -1,10 +1,7 @@