mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-10 22:08:32 +01:00
Summary: Ref T12956. Currently, when you visit `/maniphest/` (or any other ApplicationSearch application) we execute the first query in the list by default. In T12956, I plan to make changes so that personal queries are always first, then global/builtin queries. Without changing the "default query" rule, this will make it harder to have, for example, some custom queries in Differential but still run a global query like "Active" by default. To make this work, you'd have to save a personal copy of the "Active" query, then put it at the top. This feels a bit cumbersome and this rule is kind of implicit and a little weird anyway. To make this work a little better as we make changes here, add an explicit pinning action, like the one we have in Project ProfileMenus. You can now explicitly choose a query to make default. Test Plan: - Browsed without pinning anything, saw normal behavior. - Pinned queries, viewed `/maniphest/`, saw a non-initial query selected by default. - Pinned a query, deleted it, nothing exploded. {F5098484} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12956 Differential Revision: https://secure.phabricator.com/D18422
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorNamedQueryConfigQuery
|
|
extends PhabricatorCursorPagedPolicyAwareQuery {
|
|
|
|
private $ids;
|
|
private $engineClassNames;
|
|
private $scopePHIDs;
|
|
|
|
public function withIDs(array $ids) {
|
|
$this->ids = $ids;
|
|
return $this;
|
|
}
|
|
|
|
public function withScopePHIDs(array $scope_phids) {
|
|
$this->scopePHIDs = $scope_phids;
|
|
return $this;
|
|
}
|
|
|
|
public function withEngineClassNames(array $engine_class_names) {
|
|
$this->engineClassNames = $engine_class_names;
|
|
return $this;
|
|
}
|
|
|
|
public function newResultObject() {
|
|
return new PhabricatorNamedQueryConfig();
|
|
}
|
|
|
|
protected function loadPage() {
|
|
return $this->loadStandardPage($this->newResultObject());
|
|
}
|
|
|
|
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
|
$where = parent::buildWhereClauseParts($conn);
|
|
|
|
if ($this->ids !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'id IN (%Ld)',
|
|
$this->ids);
|
|
}
|
|
|
|
if ($this->engineClassNames !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'engineClassName IN (%Ls)',
|
|
$this->engineClassNames);
|
|
}
|
|
|
|
if ($this->scopePHIDs !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'scopePHID IN (%Ls)',
|
|
$this->scopePHIDs);
|
|
}
|
|
|
|
return $where;
|
|
}
|
|
|
|
public function getQueryApplicationClass() {
|
|
return 'PhabricatorSearchApplication';
|
|
}
|
|
|
|
}
|