Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14753967
D20633.id49232.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D20633.id49232.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4198,6 +4198,7 @@
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
'PhabricatorProjectColumnTransactionType' => 'applications/project/xaction/column/PhabricatorProjectColumnTransactionType.php',
'PhabricatorProjectColumnTriggerTransaction' => 'applications/project/xaction/column/PhabricatorProjectColumnTriggerTransaction.php',
+ 'PhabricatorProjectColumnViewQueryController' => 'applications/project/controller/PhabricatorProjectColumnViewQueryController.php',
'PhabricatorProjectConfigOptions' => 'applications/project/config/PhabricatorProjectConfigOptions.php',
'PhabricatorProjectConfiguredCustomField' => 'applications/project/customfield/PhabricatorProjectConfiguredCustomField.php',
'PhabricatorProjectController' => 'applications/project/controller/PhabricatorProjectController.php',
@@ -10473,6 +10474,7 @@
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorProjectColumnTransactionType' => 'PhabricatorModularTransactionType',
'PhabricatorProjectColumnTriggerTransaction' => 'PhabricatorProjectColumnTransactionType',
+ 'PhabricatorProjectColumnViewQueryController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorProjectConfiguredCustomField' => array(
'PhabricatorProjectStandardCustomField',
diff --git a/src/applications/project/application/PhabricatorProjectApplication.php b/src/applications/project/application/PhabricatorProjectApplication.php
--- a/src/applications/project/application/PhabricatorProjectApplication.php
+++ b/src/applications/project/application/PhabricatorProjectApplication.php
@@ -79,6 +79,8 @@
=> 'PhabricatorProjectColumnHideController',
'column/(?:(?P<id>\d+)/)?'
=> 'PhabricatorProjectColumnDetailController',
+ 'viewquery/(?P<columnID>\d+)/'
+ => 'PhabricatorProjectColumnViewQueryController',
'import/'
=> 'PhabricatorProjectBoardImportController',
'reorder/'
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -122,46 +122,6 @@
->appendChild($content);
}
- // If the user wants to turn a particular column into a query, build an
- // apropriate filter and redirect them to the query results page.
- $query_column_id = $request->getInt('queryColumnID');
- if ($query_column_id) {
- $column_id_map = mpull($columns, null, 'getID');
- $query_column = idx($column_id_map, $query_column_id);
- if (!$query_column) {
- return new Aphront404Response();
- }
-
- // Create a saved query to combine the active filter on the workboard
- // with the column filter. If the user currently has constraints on the
- // board, we want to add a new column or project constraint, not
- // completely replace the constraints.
- $saved_query = $saved->newCopy();
-
- if ($query_column->getProxyPHID()) {
- $project_phids = $saved_query->getParameter('projectPHIDs');
- if (!$project_phids) {
- $project_phids = array();
- }
- $project_phids[] = $query_column->getProxyPHID();
- $saved_query->setParameter('projectPHIDs', $project_phids);
- } else {
- $saved_query->setParameter(
- 'columnPHIDs',
- array($query_column->getPHID()));
- }
-
- $search_engine = id(new ManiphestTaskSearchEngine())
- ->setViewer($viewer);
- $search_engine->saveQuery($saved_query);
-
- $query_key = $saved_query->getQueryKey();
- $query_uri = new PhutilURI("/maniphest/query/{$query_key}/#R");
-
- return id(new AphrontRedirectResponse())
- ->setURI($query_uri);
- }
-
$task_can_edit_map = id(new PhabricatorPolicyFilter())
->setViewer($viewer)
->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT))
@@ -1004,6 +964,7 @@
$request = $this->getRequest();
$viewer = $request->getUser();
+ $state = $this->getViewState();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
@@ -1062,8 +1023,8 @@
->setHref($batch_move_uri)
->setWorkflow(true);
- $query_uri = $request->getRequestURI();
- $query_uri->replaceQueryParam('queryColumnID', $column->getID());
+ $query_uri = urisprintf('viewquery/%d/', $column->getID());
+ $query_uri = $state->newWorkboardURI($query_uri);
$column_items[] = id(new PhabricatorActionView())
->setName(pht('View as Query'))
diff --git a/src/applications/project/controller/PhabricatorProjectColumnViewQueryController.php b/src/applications/project/controller/PhabricatorProjectColumnViewQueryController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/controller/PhabricatorProjectColumnViewQueryController.php
@@ -0,0 +1,72 @@
+<?php
+
+final class PhabricatorProjectColumnViewQueryController
+ extends PhabricatorProjectBoardController {
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+
+ $response = $this->loadProject();
+ if ($response) {
+ return $response;
+ }
+
+ $project = $this->getProject();
+ $state = $this->getViewState();
+ $board_uri = $state->newWorkboardURI();
+
+ // NOTE: We're performing layout without handing the "LayoutEngine" any
+ // object PHIDs. We only want to get access to the column object the user
+ // is trying to query, so we do not need to actually position any cards on
+ // the board.
+
+ $board_phid = $project->getPHID();
+
+ $layout_engine = id(new PhabricatorBoardLayoutEngine())
+ ->setViewer($viewer)
+ ->setBoardPHIDs(array($board_phid))
+ ->setFetchAllBoards(true)
+ ->executeLayout();
+
+ $columns = $layout_engine->getColumns($board_phid);
+ $columns = mpull($columns, null, 'getID');
+
+ $column_id = $request->getURIData('columnID');
+ $column = idx($columns, $column_id);
+ if (!$column) {
+ return new Aphront404Response();
+ }
+
+ // Create a saved query to combine the active filter on the workboard
+ // with the column filter. If the user currently has constraints on the
+ // board, we want to add a new column or project constraint, not
+ // completely replace the constraints.
+ $default_query = $state->getSavedQuery();
+ $saved_query = $default_query->newCopy();
+
+ if ($column->getProxyPHID()) {
+ $project_phids = $saved_query->getParameter('projectPHIDs');
+ if (!$project_phids) {
+ $project_phids = array();
+ }
+ $project_phids[] = $column->getProxyPHID();
+ $saved_query->setParameter('projectPHIDs', $project_phids);
+ } else {
+ $saved_query->setParameter(
+ 'columnPHIDs',
+ array($column->getPHID()));
+ }
+
+ $search_engine = id(new ManiphestTaskSearchEngine())
+ ->setViewer($viewer);
+
+ $search_engine->saveQuery($saved_query);
+
+ $query_key = $saved_query->getQueryKey();
+ $query_uri = new PhutilURI("/maniphest/query/{$query_key}/#R");
+
+ return id(new AphrontRedirectResponse())
+ ->setURI($query_uri);
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 3:22 PM (8 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7034263
Default Alt Text
D20633.id49232.diff (7 KB)
Attached To
Mode
D20633: Move workboard "View as Query" workflow to a separate controller
Attached
Detach File
Event Timeline
Log In to Comment