1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Add a priorityColor property to the maniphest conduit endpoint

Summary:
I added a getTaskPriorityColor function to the ManiphestTaskPriority class which returns the color set in the maniphest config for the given priority.

This is in preparation for a change to arcanist which will allow it to display the priority color (if it is a supported color) upon running `arc tasks`.

Fixed some linting issues

Test Plan:
Invoke the maniphest.info method from conduit and ensure that:
 * The priorityColor property is given in the json
 * the priorityColor property is set correctly

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D8734
This commit is contained in:
Brayden Winterton 2014-04-09 11:32:08 -07:00 committed by epriestley
parent 2d43cf1296
commit b660960771
2 changed files with 13 additions and 0 deletions

View file

@ -265,6 +265,8 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
'isClosed' => $task->isClosed(),
'priority' => ManiphestTaskPriority::getTaskPriorityName(
$task->getPriority()),
'priorityColor' => ManiphestTaskPriority::getTaskPriorityColor(
$task->getPriority()),
'title' => $task->getTitle(),
'description' => $task->getDescription(),
'projectPHIDs' => $task->getProjectPHIDs(),

View file

@ -64,6 +64,17 @@ final class ManiphestTaskPriority extends ManiphestConstants {
return idx(self::getTaskPriorityMap(), $priority, $priority);
}
/**
* Retrieve the color of the priority level given
*
* @param int A priority level.
* @return string The color of the priority if the level is valid,
* or black if it is not.
*/
public static function getTaskPriorityColor($priority) {
return idx(self::getColorMap(), $priority, 'black');
}
private static function getConfig() {
$config = PhabricatorEnv::getEnvConfig('maniphest.priorities');