Page MenuHomePhabricator

D15289.id36885.diff
No OneTemporary

D15289.id36885.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 $watcherPHIDs;
private $slugs;
private $slugNormals;
private $slugMap;
@@ -62,6 +63,11 @@
return $this;
}
+ public function withWatcherPHIDs(array $watcher_phids) {
+ $this->watcherPHIDs = $watcher_phids;
+ return $this;
+ }
+
public function withSlugs(array $slugs) {
$this->slugs = $slugs;
return $this;
@@ -436,6 +442,13 @@
$this->memberPHIDs);
}
+ if ($this->watcherPHIDs !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'w.dst IN (%Ls)',
+ $this->watcherPHIDs);
+ }
+
if ($this->slugs !== null) {
$where[] = qsprintf(
$conn,
@@ -549,7 +562,7 @@
}
protected function shouldGroupQueryResultRows() {
- if ($this->memberPHIDs || $this->nameTokens) {
+ if ($this->memberPHIDs || $this->watcherPHIDs || $this->nameTokens) {
return true;
}
return parent::shouldGroupQueryResultRows();
@@ -566,6 +579,14 @@
PhabricatorProjectMaterializedMemberEdgeType::EDGECONST);
}
+ if ($this->watcherPHIDs !== null) {
+ $joins[] = qsprintf(
+ $conn,
+ 'JOIN %T w ON w.src = p.phid AND w.type = %d',
+ PhabricatorEdgeConfig::TABLE_NAME_EDGE,
+ PhabricatorObjectHasWatcherEdgeType::EDGECONST);
+ }
+
if ($this->slugs !== null) {
$joins[] = qsprintf(
$conn,
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
@@ -26,6 +26,10 @@
->setLabel(pht('Members'))
->setKey('memberPHIDs')
->setAliases(array('member', 'members')),
+ id(new PhabricatorUsersSearchField())
+ ->setLabel(pht('Watchers'))
+ ->setKey('watcherPHIDs')
+ ->setAliases(array('watcher', 'watchers')),
id(new PhabricatorSearchSelectField())
->setLabel(pht('Status'))
->setKey('status')
@@ -54,6 +58,10 @@
$query->withMemberPHIDs($map['memberPHIDs']);
}
+ if ($map['watcherPHIDs']) {
+ $query->withWatcherPHIDs($map['watcherPHIDs']);
+ }
+
if ($map['status']) {
$status = idx($this->getStatusValues(), $map['status']);
if ($status) {

File Metadata

Mime Type
text/plain
Expires
Mar 16 2025, 11:51 PM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7321961
Default Alt Text
D15289.id36885.diff (2 KB)

Event Timeline