Page MenuHomePhabricator

D10480.id25223.diff
No OneTemporary

D10480.id25223.diff

Index: src/applications/people/query/PhabricatorPeopleQuery.php
===================================================================
--- src/applications/people/query/PhabricatorPeopleQuery.php
+++ src/applications/people/query/PhabricatorPeopleQuery.php
@@ -249,10 +249,11 @@
$this->dateCreatedBefore);
}
- if ($this->isAdmin) {
+ if ($this->isAdmin !== null) {
$where[] = qsprintf(
$conn_r,
- 'user.isAdmin = 1');
+ 'user.isAdmin = %d',
+ (int)$this->isAdmin);
}
if ($this->isDisabled !== null) {
@@ -269,10 +270,11 @@
(int)$this->isApproved);
}
- if ($this->isSystemAgent) {
+ if ($this->isSystemAgent !== null) {
$where[] = qsprintf(
$conn_r,
- 'user.isSystemAgent = 1');
+ 'user.isSystemAgent = %d',
+ (int)$this->isSystemAgent);
}
if (strlen($this->nameLike)) {
Index: src/applications/people/query/PhabricatorPeopleSearchEngine.php
===================================================================
--- src/applications/people/query/PhabricatorPeopleSearchEngine.php
+++ src/applications/people/query/PhabricatorPeopleSearchEngine.php
@@ -20,12 +20,20 @@
$saved->setParameter('usernames', $request->getStrList('usernames'));
$saved->setParameter('nameLike', $request->getStr('nameLike'));
- $saved->setParameter('isAdmin', $request->getStr('isAdmin'));
- $saved->setParameter('isDisabled', $request->getStr('isDisabled'));
- $saved->setParameter('isSystemAgent', $request->getStr('isSystemAgent'));
- $saved->setParameter('needsApproval', $request->getStr('needsApproval'));
$saved->setParameter('createdStart', $request->getStr('createdStart'));
$saved->setParameter('createdEnd', $request->getStr('createdEnd'));
+ $saved->setParameter(
+ 'isAdmin',
+ $this->readBoolFromRequest($request, 'isAdmin'));
+ $saved->setParameter(
+ 'isDisabled',
+ $this->readBoolFromRequest($request, 'isDisabled'));
+ $saved->setParameter(
+ 'isSystemAgent',
+ $this->readBoolFromRequest($request, 'isSystemAgent'));
+ $saved->setParameter(
+ 'needsApproval',
+ $this->readBoolFromRequest($request, 'needsApproval'));
$this->readCustomFieldsFromRequest($request, $saved);
@@ -65,24 +73,21 @@
$is_disabled = $saved->getParameter('isDisabled');
$is_system_agent = $saved->getParameter('isSystemAgent');
$needs_approval = $saved->getParameter('needsApproval');
- $no_disabled = $saved->getParameter('noDisabled');
- if ($is_admin) {
- $query->withIsAdmin(true);
+ if ($is_admin !== null) {
+ $query->withIsAdmin($is_admin);
}
- if ($is_disabled) {
- $query->withIsDisabled(true);
- } else if ($no_disabled) {
- $query->withIsDisabled(false);
+ if ($is_disabled !== null) {
+ $query->withIsDisabled($is_disabled);
}
- if ($is_system_agent) {
- $query->withIsSystemAgent(true);
+ if ($is_system_agent !== null) {
+ $query->withIsSystemAgent($is_system_agent);
}
- if ($needs_approval) {
- $query->withIsApproved(false);
+ if ($needs_approval !== null) {
+ $query->withIsApproved(!$needs_approval);
}
$start = $this->parseDateTime($saved->getParameter('createdStart'));
@@ -125,28 +130,49 @@
->setLabel(pht('Name Contains'))
->setValue($like))
->appendChild(
- id(new AphrontFormCheckboxControl())
- ->setLabel('Role')
- ->addCheckbox(
- 'isAdmin',
- 1,
- pht('Show only administrators.'),
- $is_admin)
- ->addCheckbox(
- 'isDisabled',
- 1,
- pht('Show only disabled users.'),
- $is_disabled)
- ->addCheckbox(
- 'isSystemAgent',
- 1,
- pht('Show only bots.'),
- $is_system_agent)
- ->addCheckbox(
- 'needsApproval',
- 1,
- pht('Show only users who need approval.'),
- $needs_approval));
+ id(new AphrontFormSelectControl())
+ ->setLabel(pht('Administrators'))
+ ->setName('isAdmin')
+ ->setValue($this->getBoolFromQuery($saved, 'isAdmin'))
+ ->setOptions(
+ array(
+ '' => pht('Show all'),
+ 'true' => pht('Show only Administrators'),
+ 'false' => pht('Show users that are not Administrators')
+ )))
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setLabel(pht('Disabled Users'))
+ ->setName('isDisabled')
+ ->setValue($this->getBoolFromQuery($saved, 'isDisabled'))
+ ->setOptions(
+ array(
+ '' => pht('Show all'),
+ 'true' => pht('Show only disabled users'),
+ 'false' => pht('Show users that are not disabled')
+ )))
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setLabel(pht('Bots'))
+ ->setName('isSystemAgent')
+ ->setValue($this->getBoolFromQuery($saved, 'isSystemAgent'))
+ ->setOptions(
+ array(
+ '' => pht('Show all'),
+ 'true' => pht('Show only bots'),
+ 'false' => pht('Show users that are not bots')
+ )))
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setLabel(pht('Approved users'))
+ ->setName('needsApproval')
+ ->setValue($this->getBoolFromQuery($saved, 'needsApproval'))
+ ->setOptions(
+ array(
+ '' => pht('Show all'),
+ 'false' => pht('Show approved users'),
+ 'true' => pht('Show only users who need approval')
+ )));
$this->appendCustomFieldsToForm($form, $saved);

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 29, 8:54 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7725734
Default Alt Text
D10480.id25223.diff (5 KB)

Event Timeline