mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-29 16:08:22 +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);
|
||||
if (!$columns || !$project->getHasWorkboard()) {
|
||||
$has_normal_columns = false;
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (!$column->getProxyPHID()) {
|
||||
$has_normal_columns = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$project,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
if (!$columns) {
|
||||
|
||||
if (!$has_normal_columns) {
|
||||
if (!$can_edit) {
|
||||
$content = $this->buildNoAccessContent($project);
|
||||
} else {
|
||||
|
|
|
@ -366,7 +366,12 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
|||
if ($board->getHasMilestones() || $board->getHasSubprojects()) {
|
||||
$child_projects = idx($children, $board_phid, array());
|
||||
|
||||
$next_sequence = last($board_columns)->getSequence() + 1;
|
||||
if ($board_columns) {
|
||||
$next_sequence = last($board_columns)->getSequence() + 1;
|
||||
} else {
|
||||
$next_sequence = 1;
|
||||
}
|
||||
|
||||
$proxy_columns = mpull($board_columns, null, 'getProxyPHID');
|
||||
foreach ($child_projects as $child_phid => $child) {
|
||||
if (isset($proxy_columns[$child_phid])) {
|
||||
|
@ -433,6 +438,7 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
|||
$position_groups = mgroup($positions, 'getObjectPHID');
|
||||
|
||||
$layout = array();
|
||||
$default_phid = null;
|
||||
foreach ($columns as $column) {
|
||||
$column_phid = $column->getPHID();
|
||||
$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 (!$positions) {
|
||||
// If the object has no position, put it on the default column if
|
||||
// one exists.
|
||||
if (!$positions && $default_phid) {
|
||||
$new_position = id(new PhabricatorProjectColumnPosition())
|
||||
->setBoardPHID($board_phid)
|
||||
->setColumnPHID($default_phid)
|
||||
|
|
Loading…
Add table
Reference in a new issue