1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Don't show any subproject tags on workboard cards

Summary: Ref T10010. This gets rid of, e.g., the "Iteration I" tag in the column for that milestone, as it is redundant with the column itself.

Test Plan: {F1090427}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

Differential Revision: https://secure.phabricator.com/D15181
This commit is contained in:
epriestley 2016-02-03 17:21:38 -08:00
parent 90a0459821
commit 2bdbd7833d
4 changed files with 54 additions and 14 deletions

View file

@ -344,11 +344,18 @@ final class ManiphestEditEngine
->executeOne();
}
$handle_phids = $task->getProjectPHIDs();
$handle_phids = array_fuse($handle_phids);
$handle_phids = array_diff_key($handle_phids, $board_phids);
$project_handles = $viewer->loadHandles($handle_phids);
$project_handles = iterator_to_array($project_handles);
$tasks = id(new ProjectBoardTaskCard())
->setViewer($viewer)
->setTask($task)
->setOwner($owner)
->setProject($column->getProject())
->setProjectHandles($project_handles)
->setCanEdit(true)
->getItem();

View file

@ -228,6 +228,20 @@ final class PhabricatorProjectBoardViewController
$this->handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks);
$all_project_phids = array();
foreach ($tasks as $task) {
foreach ($task->getProjectPHIDs() as $project_phid) {
$all_project_phids[$project_phid] = $project_phid;
}
}
foreach ($select_phids as $phid) {
unset($all_project_phids[$phid]);
}
$all_handles = $viewer->loadHandles($all_project_phids);
$all_handles = iterator_to_array($all_handles);
foreach ($columns as $column) {
if (!$this->showHidden) {
if ($column->isHidden()) {
@ -308,9 +322,12 @@ final class PhabricatorProjectBoardViewController
$owner = $this->handles[$task->getOwnerPHID()];
}
$can_edit = idx($task_can_edit_map, $task->getPHID(), false);
$handles = array_select_keys($all_handles, $task->getProjectPHIDs());
$cards->addItem(id(new ProjectBoardTaskCard())
->setViewer($viewer)
->setProject($project)
->setProjectHandles($handles)
->setTask($task)
->setOwner($owner)
->setCanEdit($can_edit)

View file

@ -195,12 +195,30 @@ final class PhabricatorProjectMoveController
))
->executeOne();
$except_phids = array($board_phid);
if ($project->getHasSubprojects() || $project->getHasMilestones()) {
$descendants = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->withAncestorProjectPHIDs($except_phids)
->execute();
foreach ($descendants as $descendant) {
$except_phids[] = $descendant->getPHID();
}
}
$except_phids = array_fuse($except_phids);
$handle_phids = array_fuse($object->getProjectPHIDs());
$handle_phids = array_diff_key($handle_phids, $except_phids);
$project_handles = $viewer->loadHandles($handle_phids);
$project_handles = iterator_to_array($project_handles);
$card = id(new ProjectBoardTaskCard())
->setViewer($viewer)
->setTask($object)
->setOwner($owner)
->setCanEdit(true)
->setProject($project)
->setProjectHandles($project_handles)
->getItem();
$card->addClass('phui-workcard');

View file

@ -3,7 +3,7 @@
final class ProjectBoardTaskCard extends Phobject {
private $viewer;
private $project;
private $projectHandles;
private $task;
private $owner;
private $canEdit;
@ -16,12 +16,13 @@ final class ProjectBoardTaskCard extends Phobject {
return $this->viewer;
}
public function setProject(PhabricatorProject $project) {
$this->project = $project;
public function setProjectHandles(array $handles) {
$this->projectHandles = $handles;
return $this;
}
public function getProject() {
return $this->project;
public function getProjectHandles() {
return $this->projectHandles;
}
public function setTask(ManiphestTask $task) {
@ -83,14 +84,11 @@ final class ProjectBoardTaskCard extends Phobject {
$card->addHandleIcon($owner, $owner->getName());
}
$project_phids = array_fuse($task->getProjectPHIDs());
unset($project_phids[$this->project->getPHID()]);
if ($project_phids) {
$handle_list = $viewer->loadHandles($project_phids);
$project_handles = $this->getProjectHandles();
if ($project_handles) {
$tag_list = id(new PHUIHandleTagListView())
->setSlim(true)
->setHandles($handle_list);
->setHandles($project_handles);
$card->addAttribute($tag_list);
}