From fc9bbb9949f8792de009376ed030045aa9eaef9c Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Fri, 31 Mar 2023 10:40:45 +0200 Subject: [PATCH] Workboard: fix regression caused by tags= prefiller Summary: This change fixes a regression introduced here: rP5e2b3677157889104a7e540d7772a04f13164037 Thank you to the user @dadalha for auditing that commit and sharing a stack trace to easily fix the issue. In short, if you see this exception you are affected: ``` EXCEPTION: (InvalidArgumentException) Value provided to "replaceQueryParam()" for key "tags" is NULL. Use "removeQueryParam()" to remove a query parameter. at [/src/parser/PhutilURI.php:341] ``` This change just fixes that specific problem. Closes T15221 Test Plan: 1. Create a new Project 2. Create a new Milestone inside 3. Create the Milestone's Workboard 4. Visit the Milestone's Workboard and note that now it works Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: speck, tobiaswiese, Matthew, Cigaryno, dadalha Tags: #workboard Maniphest Tasks: T15221 Differential Revision: https://we.phorge.it/D25103 --- .../PhabricatorProjectBoardViewController.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index d254936c1a..a24c911b9f 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -693,11 +693,19 @@ final class PhabricatorProjectBoardViewController ->newCreateActionSpecifications(array()); foreach ($specs as $spec) { + + // Prefill tags= when you open the Column menu + // https://we.phorge.it/T15147 + $spec_href = new PhutilURI($spec['uri']); + $spec_slug = $project->getPrimarySlug(); + if ($spec_slug !== null) { + $spec_href->replaceQueryParam('tags', $spec_slug); + } + $column_items[] = id(new PhabricatorActionView()) ->setIcon($spec['icon']) ->setName($spec['name']) - ->setHref(id(new PhutilURI($spec['uri'])) - ->replaceQueryParam('tags', $project->getPrimarySlug())) + ->setHref($spec_href) ->setDisabled($spec['disabled']) ->addSigil('column-add-task') ->setMetadata( -- 2.51.2