mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-30 16:38:21 +01:00
Fix two issues with unusual milestone workboard initialization orders
Summary: Fixes T10316. Fixes T10311. Test Plan: - Create a project, create a milestone, go back to the parent, go to the workboard. Previously, fatal. Now, prompts you to create workboard. - Create a project, create a milestone, create the parent workboard, put a task in the milestone's column, go to the milestone workboard. Previously, fatal. Now, prompts you to create workboard. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10311, T10316 Differential Revision: https://secure.phabricator.com/D15232
This commit is contained in:
parent
c2502f1beb
commit
7bca452fad
2 changed files with 21 additions and 4 deletions
|
@ -126,11 +126,21 @@ final class PhabricatorProjectBoardViewController
|
||||||
|
|
||||||
$columns = $layout_engine->getColumns($board_phid);
|
$columns = $layout_engine->getColumns($board_phid);
|
||||||
if (!$columns || !$project->getHasWorkboard()) {
|
if (!$columns || !$project->getHasWorkboard()) {
|
||||||
|
$has_normal_columns = false;
|
||||||
|
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
if (!$column->getProxyPHID()) {
|
||||||
|
$has_normal_columns = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
$viewer,
|
$viewer,
|
||||||
$project,
|
$project,
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
if (!$columns) {
|
|
||||||
|
if (!$has_normal_columns) {
|
||||||
if (!$can_edit) {
|
if (!$can_edit) {
|
||||||
$content = $this->buildNoAccessContent($project);
|
$content = $this->buildNoAccessContent($project);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -366,7 +366,12 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
||||||
if ($board->getHasMilestones() || $board->getHasSubprojects()) {
|
if ($board->getHasMilestones() || $board->getHasSubprojects()) {
|
||||||
$child_projects = idx($children, $board_phid, array());
|
$child_projects = idx($children, $board_phid, array());
|
||||||
|
|
||||||
|
if ($board_columns) {
|
||||||
$next_sequence = last($board_columns)->getSequence() + 1;
|
$next_sequence = last($board_columns)->getSequence() + 1;
|
||||||
|
} else {
|
||||||
|
$next_sequence = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$proxy_columns = mpull($board_columns, null, 'getProxyPHID');
|
$proxy_columns = mpull($board_columns, null, 'getProxyPHID');
|
||||||
foreach ($child_projects as $child_phid => $child) {
|
foreach ($child_projects as $child_phid => $child) {
|
||||||
if (isset($proxy_columns[$child_phid])) {
|
if (isset($proxy_columns[$child_phid])) {
|
||||||
|
@ -433,6 +438,7 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
||||||
$position_groups = mgroup($positions, 'getObjectPHID');
|
$position_groups = mgroup($positions, 'getObjectPHID');
|
||||||
|
|
||||||
$layout = array();
|
$layout = array();
|
||||||
|
$default_phid = null;
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
$column_phid = $column->getPHID();
|
$column_phid = $column->getPHID();
|
||||||
$layout[$column_phid] = array();
|
$layout[$column_phid] = array();
|
||||||
|
@ -565,8 +571,9 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the object has no position, put it on the default column.
|
// If the object has no position, put it on the default column if
|
||||||
if (!$positions) {
|
// one exists.
|
||||||
|
if (!$positions && $default_phid) {
|
||||||
$new_position = id(new PhabricatorProjectColumnPosition())
|
$new_position = id(new PhabricatorProjectColumnPosition())
|
||||||
->setBoardPHID($board_phid)
|
->setBoardPHID($board_phid)
|
||||||
->setColumnPHID($default_phid)
|
->setColumnPHID($default_phid)
|
||||||
|
|
Loading…
Add table
Reference in a new issue