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:
committed by
epriestley
parent
2d43cf1296
commit
b660960771
@@ -265,6 +265,8 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
|
|||||||
'isClosed' => $task->isClosed(),
|
'isClosed' => $task->isClosed(),
|
||||||
'priority' => ManiphestTaskPriority::getTaskPriorityName(
|
'priority' => ManiphestTaskPriority::getTaskPriorityName(
|
||||||
$task->getPriority()),
|
$task->getPriority()),
|
||||||
|
'priorityColor' => ManiphestTaskPriority::getTaskPriorityColor(
|
||||||
|
$task->getPriority()),
|
||||||
'title' => $task->getTitle(),
|
'title' => $task->getTitle(),
|
||||||
'description' => $task->getDescription(),
|
'description' => $task->getDescription(),
|
||||||
'projectPHIDs' => $task->getProjectPHIDs(),
|
'projectPHIDs' => $task->getProjectPHIDs(),
|
||||||
|
|||||||
@@ -64,6 +64,17 @@ final class ManiphestTaskPriority extends ManiphestConstants {
|
|||||||
return idx(self::getTaskPriorityMap(), $priority, $priority);
|
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() {
|
private static function getConfig() {
|
||||||
$config = PhabricatorEnv::getEnvConfig('maniphest.priorities');
|
$config = PhabricatorEnv::getEnvConfig('maniphest.priorities');
|
||||||
|
|||||||
Reference in New Issue
Block a user