1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Show current board for tasks in Maniphest

Summary:
Ref T1344. When rendering a task's projects, add "(Board)" afterward if the task is on a non-default board.

This is mostly a "get the data there" change, we can probably make the design nicer.

Test Plan: {F101232}

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1344

Differential Revision: https://secure.phabricator.com/D7945
This commit is contained in:
epriestley 2014-01-13 12:25:12 -08:00
parent bc9326adbc
commit f574100315

View file

@ -548,11 +548,52 @@ final class ManiphestTaskDetailController extends ManiphestController {
$source));
}
$view->addProperty(
pht('Projects'),
$task->getProjectPHIDs()
? $this->renderHandlesForPHIDs($task->getProjectPHIDs(), ',')
: phutil_tag('em', array(), pht('None')));
$project_phids = $task->getProjectPHIDs();
if ($project_phids) {
// If we end up with real-world projects with many hundreds of columns, it
// might be better to just load all the edges, then load those columns and
// work backward that way, or denormalize this data more.
$columns = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
->withProjectPHIDs($project_phids)
->execute();
$columns = mpull($columns, null, 'getPHID');
$column_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_COLUMN;
$all_column_phids = array_keys($columns);
$column_edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($task->getPHID()))
->withEdgeTypes(array($column_edge_type))
->withDestinationPHIDs($all_column_phids);
$column_edge_query->execute();
$in_column_phids = array_fuse($column_edge_query->getDestinationPHIDs());
$column_groups = mgroup($columns, 'getProjectPHID');
$project_rows = array();
foreach ($project_phids as $project_phid) {
$row = array();
$handle = $this->getHandle($project_phid);
$row[] = $handle->renderLink();
$columns = idx($column_groups, $project_phid, array());
$column = head(array_intersect_key($columns, $in_column_phids));
if ($column) {
if (!$column->isDefaultColumn()) {
$row[] = pht(' (%s)', $column->getDisplayName());
}
}
$project_rows[] = phutil_tag('div', array(), $row);
}
} else {
$project_rows = phutil_tag('em', array(), pht('None'));
}
$view->addProperty(pht('Projects'), $project_rows);
$edge_types = array(
PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK