Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/maniphest/controller/taskselectorsearch/ManiphestTaskSelectorSearchController.php b/src/applications/maniphest/controller/taskselectorsearch/ManiphestTaskSelectorSearchController.php
index f547f5e592..499d5bafcd 100644
--- a/src/applications/maniphest/controller/taskselectorsearch/ManiphestTaskSelectorSearchController.php
+++ b/src/applications/maniphest/controller/taskselectorsearch/ManiphestTaskSelectorSearchController.php
@@ -1,58 +1,87 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ManiphestTaskSelectorSearchController extends ManiphestController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$query = new PhabricatorSearchQuery();
- $query->setQuery($request->getStr('query'));
+
+ $query_str = $request->getStr('query');
+ $matches = array();
+ $task_ids = array();
+
+ // Collect all task IDs, e.g., T12 T651 T631, from the query string
+ preg_match_all('/\bT(\d+)\b/', $query_str, $matches);
+ if ($matches) {
+ $task_ids = $matches[1];
+ }
+
+ $query->setQuery($query_str);
$query->setParameter('type', PhabricatorPHIDConstants::PHID_TYPE_TASK);
switch ($request->getStr('filter')) {
case 'assigned':
$query->setParameter('owner', array($user->getPHID()));
$query->setParameter('open', 1);
break;
case 'created';
$query->setParameter('author', array($user->getPHID()));
$query->setParameter('open', 1);
break;
case 'open':
$query->setParameter('open', 1);
break;
}
$exec = new PhabricatorSearchMySQLExecutor();
$results = $exec->executeSearch($query);
- $results = ipull($results, 'phid');
- $handles = id(new PhabricatorObjectHandleData($results))
+ $phids = array();
+
+ foreach ($results as $result) {
+ $phids[$result['phid']] = true;
+ }
+
+ // Do a separate query for task IDs if the query had them
+ if ($task_ids) {
+ $task_object = new ManiphestTask();
+
+ // It's OK to ignore filters, if user wants specific task IDs
+ $tasks = $task_object->loadAllWhere('id IN (%Ls)', $task_ids);
+
+ foreach ($tasks as $task) {
+ $phids[$task->getPHID()] = true;
+ }
+ }
+
+ $phids = array_keys($phids);
+ $handles = id(new PhabricatorObjectHandleData($phids))
->loadHandles();
$data = array();
foreach ($handles as $handle) {
$view = new PhabricatorHandleObjectSelectorDataView($handle);
$data[] = $view->renderData();
}
return id(new AphrontAjaxResponse())->setContent($data);
}
}
diff --git a/src/applications/maniphest/controller/taskselectorsearch/__init__.php b/src/applications/maniphest/controller/taskselectorsearch/__init__.php
index 3475c1e17b..6d45ca9abc 100644
--- a/src/applications/maniphest/controller/taskselectorsearch/__init__.php
+++ b/src/applications/maniphest/controller/taskselectorsearch/__init__.php
@@ -1,20 +1,21 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'aphront/response/ajax');
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
+phutil_require_module('phabricator', 'applications/maniphest/storage/task');
phutil_require_module('phabricator', 'applications/phid/constants');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'applications/phid/handle/view/selector');
phutil_require_module('phabricator', 'applications/search/execute/mysql');
phutil_require_module('phabricator', 'applications/search/storage/query');
phutil_require_module('phutil', 'utils');
phutil_require_source('ManiphestTaskSelectorSearchController.php');

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jul 24, 4:56 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
182525
Default Alt Text
(4 KB)

Event Timeline