From 9d37ad3022bfff8a2900b9d728e6abbb6a1e27f0 Mon Sep 17 00:00:00 2001 From: Austin McKinley Date: Fri, 26 May 2017 15:39:18 -0700 Subject: [PATCH] Add maniphest.priority.search method Summary: Start on plan outlined in T12124. Adds a new Conduit method for querying information about task priorities. Test Plan: Ran locally; observed expected output: {F4979109} Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D18035 --- src/__phutil_library_map__.php | 2 + ...aniphestPrioritySearchConduitAPIMethod.php | 44 +++++++++++++++++++ .../constants/ManiphestTaskPriority.php | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/applications/maniphest/conduit/ManiphestPrioritySearchConduitAPIMethod.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 1b742b5730..ce3cc27784 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1494,6 +1494,7 @@ phutil_register_library_map(array( 'ManiphestPointsConfigOptionType' => 'applications/maniphest/config/ManiphestPointsConfigOptionType.php', 'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php', 'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php', + 'ManiphestPrioritySearchConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestPrioritySearchConduitAPIMethod.php', 'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php', 'ManiphestQueryConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php', 'ManiphestQueryStatusesConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php', @@ -6593,6 +6594,7 @@ phutil_register_library_map(array( 'ManiphestPointsConfigOptionType' => 'PhabricatorConfigJSONOptionType', 'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType', 'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand', + 'ManiphestPrioritySearchConduitAPIMethod' => 'ManiphestConduitAPIMethod', 'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension', 'ManiphestQueryConduitAPIMethod' => 'ManiphestConduitAPIMethod', 'ManiphestQueryStatusesConduitAPIMethod' => 'ManiphestConduitAPIMethod', diff --git a/src/applications/maniphest/conduit/ManiphestPrioritySearchConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestPrioritySearchConduitAPIMethod.php new file mode 100644 index 0000000000..eab06fb780 --- /dev/null +++ b/src/applications/maniphest/conduit/ManiphestPrioritySearchConduitAPIMethod.php @@ -0,0 +1,44 @@ +'; + } + + public function getRequiredScope() { + return self::SCOPE_ALWAYS; + } + + protected function execute(ConduitAPIRequest $request) { + $config = ManiphestTaskPriority::getConfig(); + + $results = array(); + foreach ($config as $code => $priority) { + $priority['value'] = $code; + $results[] = $priority; + } + + return array('data' => $results); + } + +} diff --git a/src/applications/maniphest/constants/ManiphestTaskPriority.php b/src/applications/maniphest/constants/ManiphestTaskPriority.php index 16a35a9e83..dd2ab69c69 100644 --- a/src/applications/maniphest/constants/ManiphestTaskPriority.php +++ b/src/applications/maniphest/constants/ManiphestTaskPriority.php @@ -110,7 +110,7 @@ final class ManiphestTaskPriority extends ManiphestConstants { return idx($config, 'disabled', false); } - private static function getConfig() { + public static function getConfig() { $config = PhabricatorEnv::getEnvConfig('maniphest.priorities'); krsort($config); return $config;