mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-23 13:08:18 +01:00
Rename setMembers() to withMemberPHIDs() in PhabricatorProjectQuery
Summary: This is clearer and more consistent with other Query classes. Test Plan: Used home page, conduit api, project list, other interfaces. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D3179
This commit is contained in:
parent
d25d9ddb01
commit
b0fda3be25
7 changed files with 14 additions and 15 deletions
|
@ -323,7 +323,7 @@ final class PhabricatorAuditCommentEditor {
|
||||||
|
|
||||||
// The user can audit on behalf of all projects they are a member of.
|
// The user can audit on behalf of all projects they are a member of.
|
||||||
$query = new PhabricatorProjectQuery();
|
$query = new PhabricatorProjectQuery();
|
||||||
$query->setMembers(array($user->getPHID()));
|
$query->withMemberPHIDs(array($user->getPHID()));
|
||||||
$projects = $query->execute();
|
$projects = $query->execute();
|
||||||
foreach ($projects as $project) {
|
foreach ($projects as $project) {
|
||||||
$phids[$project->getPHID()] = true;
|
$phids[$project->getPHID()] = true;
|
||||||
|
|
|
@ -77,7 +77,7 @@ final class ConduitAPI_project_query_Method extends ConduitAPI_project_Method {
|
||||||
|
|
||||||
$members = $request->getValue('members');
|
$members = $request->getValue('members');
|
||||||
if ($members) {
|
if ($members) {
|
||||||
$query->setMembers($members);
|
$query->withMemberPHIDs($members);
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = $request->getValue('limit');
|
$limit = $request->getValue('limit');
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class PhabricatorDirectoryMainController
|
||||||
case 'home':
|
case 'home':
|
||||||
case 'feed':
|
case 'feed':
|
||||||
$project_query = new PhabricatorProjectQuery();
|
$project_query = new PhabricatorProjectQuery();
|
||||||
$project_query->setMembers(array($user->getPHID()));
|
$project_query->withMemberPHIDs(array($user->getPHID()));
|
||||||
$projects = $project_query->execute();
|
$projects = $project_query->execute();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -700,7 +700,7 @@ final class ManiphestTaskListController extends ManiphestController {
|
||||||
|
|
||||||
if ($this->view == 'projecttriage' || $this->view == 'projectall') {
|
if ($this->view == 'projecttriage' || $this->view == 'projectall') {
|
||||||
$project_query = new PhabricatorProjectQuery();
|
$project_query = new PhabricatorProjectQuery();
|
||||||
$project_query->setMembers($user_phids);
|
$project_query->withMemberPHIDs($user_phids);
|
||||||
$projects = $project_query->execute();
|
$projects = $project_query->execute();
|
||||||
$project_phids = mpull($projects, 'getPHID');
|
$project_phids = mpull($projects, 'getPHID');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -73,13 +73,12 @@ final class PhabricatorOwnersOwner extends PhabricatorOwnersDAO {
|
||||||
// any project the user is a member of.
|
// any project the user is a member of.
|
||||||
public static function loadAffiliatedPackages($user_phid) {
|
public static function loadAffiliatedPackages($user_phid) {
|
||||||
$query = new PhabricatorProjectQuery();
|
$query = new PhabricatorProjectQuery();
|
||||||
$query->setMembers(array($user_phid));
|
$query->withMemberPHIDs(array($user_phid));
|
||||||
$query->withStatus(PhabricatorProjectQuery::STATUS_ACTIVE);
|
$query->withStatus(PhabricatorProjectQuery::STATUS_ACTIVE);
|
||||||
$projects = $query->execute();
|
$projects = $query->execute();
|
||||||
|
|
||||||
$phids = mpull($projects, 'getPHID') + array($user_phid);
|
$phids = mpull($projects, 'getPHID') + array($user_phid);
|
||||||
return
|
return id(new PhabricatorOwnersOwner())->loadAllWhere(
|
||||||
id(new PhabricatorOwnersOwner())->loadAllWhere(
|
|
||||||
'userPHID in (%Ls)',
|
'userPHID in (%Ls)',
|
||||||
$phids);
|
$phids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ final class PhabricatorProjectListController
|
||||||
switch ($this->filter) {
|
switch ($this->filter) {
|
||||||
case 'active':
|
case 'active':
|
||||||
$table_header = 'Your Projects';
|
$table_header = 'Your Projects';
|
||||||
$query->setMembers(array($view_phid));
|
$query->withMemberPHIDs(array($view_phid));
|
||||||
$query->withStatus(PhabricatorProjectQuery::STATUS_ACTIVE);
|
$query->withStatus(PhabricatorProjectQuery::STATUS_ACTIVE);
|
||||||
break;
|
break;
|
||||||
case 'allactive':
|
case 'allactive':
|
||||||
|
|
|
@ -20,7 +20,7 @@ final class PhabricatorProjectQuery {
|
||||||
|
|
||||||
private $ids;
|
private $ids;
|
||||||
private $phids;
|
private $phids;
|
||||||
private $members;
|
private $memberPHIDs;
|
||||||
|
|
||||||
private $status = 'status-any';
|
private $status = 'status-any';
|
||||||
const STATUS_ANY = 'status-any';
|
const STATUS_ANY = 'status-any';
|
||||||
|
@ -59,8 +59,8 @@ final class PhabricatorProjectQuery {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMembers(array $members) {
|
public function withMemberPHIDs(array $member_phids) {
|
||||||
$this->members = $members;
|
$this->memberPHIDs = $member_phids;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,13 +182,13 @@ final class PhabricatorProjectQuery {
|
||||||
$affil_table = new PhabricatorProjectAffiliation();
|
$affil_table = new PhabricatorProjectAffiliation();
|
||||||
|
|
||||||
$joins = array();
|
$joins = array();
|
||||||
if ($this->members) {
|
if ($this->memberPHIDs) {
|
||||||
$joins[] = qsprintf(
|
$joins[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'JOIN %T member ON member.projectPHID = p.phid
|
'JOIN %T member ON member.projectPHID = p.phid
|
||||||
AND member.userPHID in (%Ls)',
|
AND member.userPHID in (%Ls)',
|
||||||
$affil_table->getTableName(),
|
$affil_table->getTableName(),
|
||||||
$this->members);
|
$this->memberPHIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(' ', $joins);
|
return implode(' ', $joins);
|
||||||
|
|
Loading…
Add table
Reference in a new issue