1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

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
This commit is contained in:
Austin McKinley 2017-05-26 15:39:18 -07:00
parent 04fd93e51e
commit 9d37ad3022
3 changed files with 47 additions and 1 deletions

View file

@ -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',

View file

@ -0,0 +1,44 @@
<?php
final class ManiphestPrioritySearchConduitAPIMethod
extends ManiphestConduitAPIMethod {
public function getAPIMethodName() {
return 'maniphest.priority.search';
}
public function getMethodSummary() {
return pht('Read information about task priorities.');
}
public function getMethodDescription() {
return pht(
'Returns information about the possible priorities for Maniphest '.
'tasks.');
}
protected function defineParamTypes() {
return array();
}
protected function defineReturnType() {
return 'map<string, wild>';
}
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);
}
}

View file

@ -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;