1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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(); ->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()) $tasks = id(new ProjectBoardTaskCard())
->setViewer($viewer) ->setViewer($viewer)
->setTask($task) ->setTask($task)
->setOwner($owner) ->setOwner($owner)
->setProject($column->getProject()) ->setProjectHandles($project_handles)
->setCanEdit(true) ->setCanEdit(true)
->getItem(); ->getItem();

View file

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

View file

@ -195,12 +195,30 @@ final class PhabricatorProjectMoveController
)) ))
->executeOne(); ->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()) $card = id(new ProjectBoardTaskCard())
->setViewer($viewer) ->setViewer($viewer)
->setTask($object) ->setTask($object)
->setOwner($owner) ->setOwner($owner)
->setCanEdit(true) ->setCanEdit(true)
->setProject($project) ->setProjectHandles($project_handles)
->getItem(); ->getItem();
$card->addClass('phui-workcard'); $card->addClass('phui-workcard');

View file

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