From 11a20079ef246fcd0c0cba5b6b3f7419faeaa2b7 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Fri, 9 Jan 2015 11:12:21 -0800 Subject: [PATCH] Maniphest / Workboards - show workboard column when adding a project to a task Summary: Fixes T6471. This makes adding projects to tasks have better workflow towards boards; without it, you have to click project -> board -> do stuff on board as opposed to column -> do stuff on board. Test Plan: added and removed projets. saw column listed parenthetcally when expected Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6471 Differential Revision: https://secure.phabricator.com/D11260 --- .../events/PhabricatorProjectUIEventListener.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/applications/project/events/PhabricatorProjectUIEventListener.php b/src/applications/project/events/PhabricatorProjectUIEventListener.php index 3dba5328b8..326a9b9878 100644 --- a/src/applications/project/events/PhabricatorProjectUIEventListener.php +++ b/src/applications/project/events/PhabricatorProjectUIEventListener.php @@ -54,12 +54,23 @@ final class PhabricatorProjectUIEventListener require_celerity_resource('maniphest-task-summary-css'); - $positions = id(new PhabricatorProjectColumnPositionQuery()) + $positions_query = id(new PhabricatorProjectColumnPositionQuery()) ->setViewer($user) ->withBoardPHIDs($project_phids) ->withObjectPHIDs(array($object->getPHID())) - ->needColumns(true) + ->needColumns(true); + + // This is important because positions will be created "on demand" + // based on the set of columns. If we don't specify it, positions + // won't be created. + $columns = id(new PhabricatorProjectColumnQuery()) + ->setViewer($user) + ->withProjectPHIDs($project_phids) ->execute(); + if ($columns) { + $positions_query->withColumns($columns); + } + $positions = $positions_query->execute(); $positions = mpull($positions, null, 'getBoardPHID'); foreach ($project_phids as $project_phid) {