1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +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.')), ->setDescription(pht('Current task owner, if task is assigned.')),
id(new PhabricatorConduitSearchFieldSpecification()) id(new PhabricatorConduitSearchFieldSpecification())
->setKey('status') ->setKey('status')
->setType('string') ->setType('map<string, wild>')
->setDescription(pht('Task status.')), ->setDescription(pht('Information about task status.')),
id(new PhabricatorConduitSearchFieldSpecification()) id(new PhabricatorConduitSearchFieldSpecification())
->setKey('priority') ->setKey('priority')
->setType('int') ->setType('map<string, wild>')
->setDescription(pht('Task priority.')), ->setDescription(pht('Information about task priority.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('subpriority')
->setType('double')
->setDescription(pht('Order within priority level.')),
); );
} }
public function getFieldValuesForConduit() { 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( return array(
'name' => $this->getTitle(), 'name' => $this->getTitle(),
'authorPHID' => $this->getAuthorPHID(), 'authorPHID' => $this->getAuthorPHID(),
'ownerPHID' => $this->getOwnerPHID(), 'ownerPHID' => $this->getOwnerPHID(),
'status' => $this->getStatus(), 'status' => $status_info,
'priority' => (int)$this->getPriority(), 'priority' => $priority_info,
'subpriority' => (double)$this->getSubpriority(),
); );
} }