Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php
index a62ed9f1d3..252449459a 100644
--- a/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php
@@ -1,197 +1,199 @@
<?php
/*
* Copyright 2012 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.
*/
final class PhabricatorTypeaheadCommonDatasourceController
extends PhabricatorTypeaheadDatasourceController {
public function willProcessRequest(array $data) {
$this->type = $data['type'];
}
public function processRequest() {
$request = $this->getRequest();
$query = $request->getStr('q');
$need_users = false;
$need_all_users = false;
$need_lists = false;
$need_projs = false;
$need_repos = false;
$need_packages = false;
$need_upforgrabs = false;
$need_arcanist_projects = false;
$need_noproject = false;
switch ($this->type) {
case 'searchowner':
$need_users = true;
$need_upforgrabs = true;
break;
case 'searchproject':
$need_projs = true;
$need_noproject = true;
break;
case 'users':
$need_users = true;
break;
case 'mailable':
$need_users = true;
$need_lists = true;
break;
case 'projects':
$need_projs = true;
break;
case 'repositories':
$need_repos = true;
break;
case 'packages':
$need_packages = true;
break;
case 'accounts':
$need_users = true;
$need_all_users = true;
break;
case 'arcanistprojects':
$need_arcanist_projects = true;
break;
}
$data = array();
if ($need_upforgrabs) {
$data[] = array(
'upforgrabs (Up For Grabs)',
null,
ManiphestTaskOwner::OWNER_UP_FOR_GRABS,
);
}
if ($need_noproject) {
$data[] = array(
'noproject (No Project)',
null,
ManiphestTaskOwner::PROJECT_NO_PROJECT,
);
}
if ($need_users) {
$columns = array(
'isSystemAgent',
'isDisabled',
'userName',
'realName',
'phid');
if ($query) {
$conn_r = id(new PhabricatorUser())->establishConnection('r');
$ids = queryfx_all(
$conn_r,
'SELECT DISTINCT userID FROM %T WHERE token LIKE %>',
PhabricatorUser::NAMETOKEN_TABLE,
$query);
$ids = ipull($ids, 'userID');
if ($ids) {
$users = id(new PhabricatorUser())->loadColumnsWhere(
$columns,
'id IN (%Ld)',
$ids);
} else {
$users = array();
}
} else {
$users = id(new PhabricatorUser())->loadColumns($columns);
}
foreach ($users as $user) {
if (!$need_all_users) {
if ($user->getIsSystemAgent()) {
continue;
}
if ($user->getIsDisabled()) {
continue;
}
}
$data[] = array(
$user->getUsername().' ('.$user->getRealName().')',
'/p/'.$user->getUsername(),
$user->getPHID(),
$user->getUsername(),
);
}
}
if ($need_lists) {
$lists = id(new PhabricatorMetaMTAMailingList())->loadAll();
foreach ($lists as $list) {
$data[] = array(
$list->getName(),
$list->getURI(),
$list->getPHID(),
);
}
}
if ($need_projs) {
- $projs = id(new PhabricatorProject())->loadAll();
+ $projs = id(new PhabricatorProject())->loadAllWhere(
+ 'status != %d',
+ PhabricatorProjectStatus::STATUS_ARCHIVED);
foreach ($projs as $proj) {
$data[] = array(
$proj->getName(),
'/project/view/'.$proj->getID().'/',
$proj->getPHID(),
);
}
}
if ($need_repos) {
$repos = id(new PhabricatorRepository())->loadAll();
foreach ($repos as $repo) {
$data[] = array(
'r'.$repo->getCallsign().' ('.$repo->getName().')',
'/diffusion/'.$repo->getCallsign().'/',
$repo->getPHID(),
'r'.$repo->getCallsign(),
);
}
}
if ($need_packages) {
$packages = id(new PhabricatorOwnersPackage())->loadAll();
foreach ($packages as $package) {
$data[] = array(
$package->getName(),
'/owners/package/'.$package->getID().'/',
$package->getPHID(),
);
}
}
if ($need_arcanist_projects) {
$arcprojs = id(new PhabricatorRepositoryArcanistProject())->loadAll();
foreach ($arcprojs as $proj) {
$data[] = array(
$proj->getName(),
null,
$proj->getPHID(),
);
}
}
return id(new AphrontAjaxResponse())
->setContent($data);
}
}
diff --git a/src/applications/typeahead/controller/common/__init__.php b/src/applications/typeahead/controller/common/__init__.php
index 225eedc9f7..68a6555355 100644
--- a/src/applications/typeahead/controller/common/__init__.php
+++ b/src/applications/typeahead/controller/common/__init__.php
@@ -1,23 +1,24 @@
<?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/constants/owner');
phutil_require_module('phabricator', 'applications/metamta/storage/mailinglist');
phutil_require_module('phabricator', 'applications/owners/storage/package');
phutil_require_module('phabricator', 'applications/people/storage/user');
+phutil_require_module('phabricator', 'applications/project/constants/status');
phutil_require_module('phabricator', 'applications/project/storage/project');
phutil_require_module('phabricator', 'applications/repository/storage/arcanistproject');
phutil_require_module('phabricator', 'applications/repository/storage/repository');
phutil_require_module('phabricator', 'applications/typeahead/controller/base');
phutil_require_module('phabricator', 'storage/queryfx');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorTypeaheadCommonDatasourceController.php');

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jul 3, 3:43 PM (5 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
165985
Default Alt Text
(7 KB)

Event Timeline