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

Provide more API information about Maniphest task statuses and priorities

Summary: Ref T9964. Priorities and statuses have metadata (colors, names, etc) which we can reasonably just return from API callers. This is so ligthweight that I think it doesn't really make sense to put in an attachment. We also use this information in `arc tasks`.

Test Plan: Called API, got sensible looking status and priority data back.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

Differential Revision: https://secure.phabricator.com/D14777
This commit is contained in:
epriestley 2015-12-14 06:53:07 -08:00
parent 0a50219f1b
commit eb8835b15e

View file

@ -413,27 +413,38 @@ final class ManiphestTask extends ManiphestDAO
->setDescription(pht('Current task owner, if task is assigned.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('status')
->setType('string')
->setDescription(pht('Task status.')),
->setType('map<string, wild>')
->setDescription(pht('Information about task status.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('priority')
->setType('int')
->setDescription(pht('Task priority.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('subpriority')
->setType('double')
->setDescription(pht('Order within priority level.')),
->setType('map<string, wild>')
->setDescription(pht('Information about task priority.')),
);
}
public function getFieldValuesForConduit() {
$status_value = $this->getStatus();
$status_info = array(
'value' => $status_value,
'name' => ManiphestTaskStatus::getTaskStatusName($status_value),
'color' => ManiphestTaskStatus::getStatusColor($status_value),
);
$priority_value = (int)$this->getPriority();
$priority_info = array(
'value' => $priority_value,
'subpriority' => (double)$this->getSubpriority(),
'name' => ManiphestTaskPriority::getTaskPriorityName($priority_value),
'color' => ManiphestTaskPriority::getTaskPriorityColor($priority_value),
);
return array(
'name' => $this->getTitle(),
'authorPHID' => $this->getAuthorPHID(),
'ownerPHID' => $this->getOwnerPHID(),
'status' => $this->getStatus(),
'priority' => (int)$this->getPriority(),
'subpriority' => (double)$this->getSubpriority(),
'status' => $status_info,
'priority' => $priority_info,
);
}