Page MenuHomePhabricator

D15181.id36649.diff
No OneTemporary

D15181.id36649.diff

diff --git a/src/applications/maniphest/editor/ManiphestEditEngine.php b/src/applications/maniphest/editor/ManiphestEditEngine.php
--- a/src/applications/maniphest/editor/ManiphestEditEngine.php
+++ b/src/applications/maniphest/editor/ManiphestEditEngine.php
@@ -344,11 +344,18 @@
->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();
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -228,6 +228,20 @@
$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 @@
$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)
diff --git a/src/applications/project/controller/PhabricatorProjectMoveController.php b/src/applications/project/controller/PhabricatorProjectMoveController.php
--- a/src/applications/project/controller/PhabricatorProjectMoveController.php
+++ b/src/applications/project/controller/PhabricatorProjectMoveController.php
@@ -195,12 +195,30 @@
))
->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');
diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php
--- a/src/applications/project/view/ProjectBoardTaskCard.php
+++ b/src/applications/project/view/ProjectBoardTaskCard.php
@@ -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 @@
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 @@
$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);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 9:57 PM (6 h, 20 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7076137
Default Alt Text
D15181.id36649.diff (5 KB)

Event Timeline