From ca14ece85fdbb9ab9c3514a1152d5a2688848cf6 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 30 Jan 2026 11:47:06 +0100 Subject: [PATCH] Do not create a second default workboard column on existing disabled board Summary: A project workboard may have existed before but got disabled. When trying to access this workboard, do not trigger `buildInitializeContent()` which will create yet another default workboard column (and duplicates the existing column on the disabled workboard) but call `buildEnableContent()` which will display the "Workboard Disabled" panel instead allowing to re-enable the workboard. Also fix some wrong indentation in a section below. Closes T16475 Test Plan: 1. Create a new project. 2. Select "Workboard" from the left sidebar. 3. Select default "Columns: New Empty Board" for that project, and click the "Create Workboard" button. 4. In the right upper corner, select {nav icon=cog}, click {nav icon=cog,name=Manage Workboard}, and select {nav icon=ban,name=Disable Workboard} 5. End up on resulting http://phorge.localhost/project/board/1/, or go explicitly to that URI by selecting "Workboard" in the project navigation panel on the left 6. Before this patch, it shows the "Create Workboard" panel, allowing you to again select "Columns: New Empty Board", click the "Create Workboard" button, and see now two default columns both named "Backlog (Default)" on the (re-enabled) workboard 7. After this patch, it shows the "Disabled Workboard" panel with a button to re-enable the workboard Reviewers: O1 Blessed Committers, mainframe98 Reviewed By: O1 Blessed Committers, mainframe98 Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T16475 Differential Revision: https://we.phorge.it/D26714 --- .../PhabricatorProjectBoardViewController.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index dd49df3955..c4e999d034 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -41,6 +41,13 @@ final class PhabricatorProjectBoardViewController if ($project->getHasWorkboard()) { $layout_engine = $state->getLayoutEngine(); $columns = $layout_engine->getColumns($board_phid); + } else { + // Avoid setting up from scratch if board existed but got disabled + $columns = id(new PhabricatorProjectColumnQuery()) + ->setViewer($viewer) + ->withProjectPHIDs(array($project->getPHID())) + ->withIsProxyColumn(false) + ->execute(); } if (!$columns || !$project->getHasWorkboard()) { @@ -941,18 +948,18 @@ final class PhabricatorProjectBoardViewController ->setProjectPHID($project->getPHID()) ->save(); - $xactions = array(); - $xactions[] = id(new PhabricatorProjectTransaction()) - ->setTransactionType( - PhabricatorProjectWorkboardTransaction::TRANSACTIONTYPE) - ->setNewValue(1); - - id(new PhabricatorProjectTransactionEditor()) - ->setActor($viewer) - ->setContentSourceFromRequest($request) - ->setContinueOnNoEffect(true) - ->setContinueOnMissingFields(true) - ->applyTransactions($project, $xactions); + $xactions = array(); + $xactions[] = id(new PhabricatorProjectTransaction()) + ->setTransactionType( + PhabricatorProjectWorkboardTransaction::TRANSACTIONTYPE) + ->setNewValue(1); + + id(new PhabricatorProjectTransactionEditor()) + ->setActor($viewer) + ->setContentSourceFromRequest($request) + ->setContinueOnNoEffect(true) + ->setContinueOnMissingFields(true) + ->applyTransactions($project, $xactions); return id(new AphrontRedirectResponse()) ->setURI($board_uri); -- 2.51.2