Page MenuHomePhabricator

D10491.diff
No OneTemporary

D10491.diff

diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -6,6 +6,7 @@
private $ids;
private $phids;
private $memberPHIDs;
+ private $nonMemberPHIDs;
private $slugs;
private $phrictionSlugs;
private $names;
@@ -45,6 +46,11 @@
return $this;
}
+ public function withNonMemberPHIDs(array $phids) {
+ $this->nonMemberPHIDs = $phids;
+ return $this;
+ }
+
public function withSlugs(array $slugs) {
$this->slugs = $slugs;
return $this;
@@ -277,6 +283,13 @@
$this->memberPHIDs);
}
+ if ($this->nonMemberPHIDs !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'e.dst NOT IN(%Ls)',
+ $this->nonMemberPHIDs);
+ }
+
if ($this->slugs !== null) {
$slugs = array();
foreach ($this->slugs as $slug) {
@@ -323,7 +336,7 @@
}
private function buildGroupClause($conn_r) {
- if ($this->memberPHIDs || $this->datasourceQuery) {
+ if ($this->memberPHIDs || $this->datasourceQuery || $this->nonMemberPHIDs) {
return 'GROUP BY p.id';
} else {
return $this->buildApplicationSearchGroupClause($conn_r);
@@ -342,7 +355,7 @@
$this->getViewer()->getPHID());
}
- if ($this->memberPHIDs !== null) {
+ if ($this->memberPHIDs !== null || $this->nonMemberPHIDs !== null) {
$joins[] = qsprintf(
$conn_r,
'JOIN %T e ON e.src = p.phid AND e.type = %d',
diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php
--- a/src/applications/project/query/PhabricatorProjectSearchEngine.php
+++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php
@@ -47,6 +47,11 @@
$query->withMemberPHIDs($member_phids);
}
+ $non_member_phids = $saved->getParameter('nonMemberPHIDs', array());
+ if ($non_member_phids && is_array($non_member_phids)) {
+ $query->withNonMemberPHIDs($non_member_phids);
+ }
+
$status = $saved->getParameter('status');
$status = idx($this->getStatusValues(), $status);
if ($status) {
@@ -151,8 +156,10 @@
if ($this->requireViewer()->isLoggedIn()) {
$names['joined'] = pht('Joined');
}
-
$names['active'] = pht('Active');
+ if ($this->requireViewer()->isLoggedIn()) {
+ $names['not-joined'] = pht('Not Joined');
+ }
$names['all'] = pht('All');
return $names;
@@ -170,6 +177,10 @@
case 'active':
return $query
->setParameter('status', 'active');
+ case 'not-joined':
+ return $query
+ ->setParameter('nonMemberPHIDs', array($viewer_phid))
+ ->setParameter('status', 'active');
case 'joined':
return $query
->setParameter('memberPHIDs', array($viewer_phid))

File Metadata

Mime Type
text/plain
Expires
Sun, May 19, 1:13 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284293
Default Alt Text
D10491.diff (2 KB)

Event Timeline