Skip to content

Commit 2bdbd78

Browse files
author
epriestley
committed
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
1 parent 90a0459 commit 2bdbd78

File tree

4 files changed

+54
-14
lines changed

4 files changed

+54
-14
lines changed

src/applications/maniphest/editor/ManiphestEditEngine.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,18 @@ private function buildCardResponse(ManiphestTask $task) {
344344
->executeOne();
345345
}
346346

347+
$handle_phids = $task->getProjectPHIDs();
348+
$handle_phids = array_fuse($handle_phids);
349+
$handle_phids = array_diff_key($handle_phids, $board_phids);
350+
351+
$project_handles = $viewer->loadHandles($handle_phids);
352+
$project_handles = iterator_to_array($project_handles);
353+
347354
$tasks = id(new ProjectBoardTaskCard())
348355
->setViewer($viewer)
349356
->setTask($task)
350357
->setOwner($owner)
351-
->setProject($column->getProject())
358+
->setProjectHandles($project_handles)
352359
->setCanEdit(true)
353360
->getItem();
354361

src/applications/project/controller/PhabricatorProjectBoardViewController.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,20 @@ public function handleRequest(AphrontRequest $request) {
228228

229229
$this->handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks);
230230

231+
$all_project_phids = array();
232+
foreach ($tasks as $task) {
233+
foreach ($task->getProjectPHIDs() as $project_phid) {
234+
$all_project_phids[$project_phid] = $project_phid;
235+
}
236+
}
237+
238+
foreach ($select_phids as $phid) {
239+
unset($all_project_phids[$phid]);
240+
}
241+
242+
$all_handles = $viewer->loadHandles($all_project_phids);
243+
$all_handles = iterator_to_array($all_handles);
244+
231245
foreach ($columns as $column) {
232246
if (!$this->showHidden) {
233247
if ($column->isHidden()) {
@@ -308,9 +322,12 @@ public function handleRequest(AphrontRequest $request) {
308322
$owner = $this->handles[$task->getOwnerPHID()];
309323
}
310324
$can_edit = idx($task_can_edit_map, $task->getPHID(), false);
325+
326+
$handles = array_select_keys($all_handles, $task->getProjectPHIDs());
327+
311328
$cards->addItem(id(new ProjectBoardTaskCard())
312329
->setViewer($viewer)
313-
->setProject($project)
330+
->setProjectHandles($handles)
314331
->setTask($task)
315332
->setOwner($owner)
316333
->setCanEdit($can_edit)

src/applications/project/controller/PhabricatorProjectMoveController.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,30 @@ public function handleRequest(AphrontRequest $request) {
195195
))
196196
->executeOne();
197197

198+
$except_phids = array($board_phid);
199+
if ($project->getHasSubprojects() || $project->getHasMilestones()) {
200+
$descendants = id(new PhabricatorProjectQuery())
201+
->setViewer($viewer)
202+
->withAncestorProjectPHIDs($except_phids)
203+
->execute();
204+
foreach ($descendants as $descendant) {
205+
$except_phids[] = $descendant->getPHID();
206+
}
207+
}
208+
209+
$except_phids = array_fuse($except_phids);
210+
$handle_phids = array_fuse($object->getProjectPHIDs());
211+
$handle_phids = array_diff_key($handle_phids, $except_phids);
212+
213+
$project_handles = $viewer->loadHandles($handle_phids);
214+
$project_handles = iterator_to_array($project_handles);
215+
198216
$card = id(new ProjectBoardTaskCard())
199217
->setViewer($viewer)
200218
->setTask($object)
201219
->setOwner($owner)
202220
->setCanEdit(true)
203-
->setProject($project)
221+
->setProjectHandles($project_handles)
204222
->getItem();
205223

206224
$card->addClass('phui-workcard');

src/applications/project/view/ProjectBoardTaskCard.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
final class ProjectBoardTaskCard extends Phobject {
44

55
private $viewer;
6-
private $project;
6+
private $projectHandles;
77
private $task;
88
private $owner;
99
private $canEdit;
@@ -16,12 +16,13 @@ public function getViewer() {
1616
return $this->viewer;
1717
}
1818

19-
public function setProject(PhabricatorProject $project) {
20-
$this->project = $project;
19+
public function setProjectHandles(array $handles) {
20+
$this->projectHandles = $handles;
2121
return $this;
2222
}
23-
public function getProject() {
24-
return $this->project;
23+
24+
public function getProjectHandles() {
25+
return $this->projectHandles;
2526
}
2627

2728
public function setTask(ManiphestTask $task) {
@@ -83,14 +84,11 @@ public function getItem() {
8384
$card->addHandleIcon($owner, $owner->getName());
8485
}
8586

86-
$project_phids = array_fuse($task->getProjectPHIDs());
87-
unset($project_phids[$this->project->getPHID()]);
88-
89-
if ($project_phids) {
90-
$handle_list = $viewer->loadHandles($project_phids);
87+
$project_handles = $this->getProjectHandles();
88+
if ($project_handles) {
9189
$tag_list = id(new PHUIHandleTagListView())
9290
->setSlim(true)
93-
->setHandles($handle_list);
91+
->setHandles($project_handles);
9492
$card->addAttribute($tag_list);
9593
}
9694

0 commit comments

Comments
 (0)