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

Provide task closed date via Conduit API, data export pipeline, and in list UI

Summary:
Depends on D19037. Ref T4434. Adds closed date to `maniphest.search` and "Export Data".

When a task has been closed, show the closed date with a checkmark in the UI instead of the modified date.

Test Plan:
  - Exported data to CSV, saw close information.
  - Saw close information in `/maniphest/`.
  - Queried for close information via `maniphest.search`.

Maniphest Tasks: T4434

Differential Revision: https://secure.phabricator.com/D19038
This commit is contained in:
epriestley 2018-02-08 14:48:16 -08:00
parent f028aa6f60
commit 4c4707e467
3 changed files with 55 additions and 3 deletions

View file

@ -456,6 +456,15 @@ final class ManiphestTaskSearchEngine
id(new PhabricatorStringExportField())
->setKey('statusName')
->setLabel(pht('Status Name')),
id(new PhabricatorEpochExportField())
->setKey('dateClosed')
->setLabel(pht('Date Closed')),
id(new PhabricatorPHIDExportField())
->setKey('closerPHID')
->setLabel(pht('Closer PHID')),
id(new PhabricatorStringExportField())
->setKey('closer')
->setLabel(pht('Closer')),
id(new PhabricatorStringExportField())
->setKey('priority')
->setLabel(pht('Priority')),
@ -492,6 +501,7 @@ final class ManiphestTaskSearchEngine
foreach ($tasks as $task) {
$phids[] = $task->getAuthorPHID();
$phids[] = $task->getOwnerPHID();
$phids[] = $task->getCloserPHID();
}
$handles = $viewer->loadHandles($phids);
@ -512,6 +522,13 @@ final class ManiphestTaskSearchEngine
$owner_name = null;
}
$closer_phid = $task->getCloserPHID();
if ($closer_phid) {
$closer_name = $handles[$closer_phid]->getName();
} else {
$closer_name = null;
}
$status_value = $task->getStatus();
$status_name = ManiphestTaskStatus::getTaskStatusName($status_value);
@ -534,6 +551,9 @@ final class ManiphestTaskSearchEngine
'title' => $task->getTitle(),
'uri' => PhabricatorEnv::getProductionURI($task->getURI()),
'description' => $task->getDescription(),
'dateClosed' => $task->getClosedEpoch(),
'closerPHID' => $closer_phid,
'closer' => $closer_name,
);
}

View file

@ -513,6 +513,16 @@ final class ManiphestTask extends ManiphestDAO
->setKey('subtype')
->setType('string')
->setDescription(pht('Subtype of the task.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('closerPHID')
->setType('phid?')
->setDescription(
pht('User who closed the task, if the task is closed.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('dateClosed')
->setType('int?')
->setDescription(
pht('Epoch timestamp when the task was closed.')),
);
}
@ -532,6 +542,11 @@ final class ManiphestTask extends ManiphestDAO
'color' => ManiphestTaskPriority::getTaskPriorityColor($priority_value),
);
$closed_epoch = $this->getClosedEpoch();
if ($closed_epoch !== null) {
$closed_epoch = (int)$closed_epoch;
}
return array(
'name' => $this->getTitle(),
'description' => array(
@ -543,6 +558,8 @@ final class ManiphestTask extends ManiphestDAO
'priority' => $priority_info,
'points' => $this->getPoints(),
'subtype' => $this->getSubtype(),
'closerPHID' => $this->getCloserPHID(),
'dateClosed' => $closed_epoch,
);
}

View file

@ -86,9 +86,24 @@ final class ManiphestTaskListView extends ManiphestView {
$item->setStatusIcon($icon.' '.$color, $tooltip);
$item->addIcon(
'none',
phabricator_datetime($task->getDateModified(), $this->getUser()));
if ($task->isClosed()) {
$closed_epoch = $task->getClosedEpoch();
// We don't expect a task to be closed without a closed epoch, but
// recover if we find one. This can happen with older objects or with
// lipsum test data.
if (!$closed_epoch) {
$closed_epoch = $task->getDateModified();
}
$item->addIcon(
'fa-check-square-o grey',
phabricator_datetime($closed_epoch, $this->getUser()));
} else {
$item->addIcon(
'none',
phabricator_datetime($task->getDateModified(), $this->getUser()));
}
if ($this->showSubpriorityControls) {
$item->setGrippable(true);