1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 08:20:57 +01:00

Pass viewer to all ManiphestTaskQuery objects

Summary: Ref T603. Prepare for conversion to a policy-aware query.

Test Plan: Browsed various interfaces which use this stuff.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D6928
This commit is contained in:
epriestley 2013-09-10 07:44:22 -07:00
parent 5651141520
commit e625c91867
7 changed files with 25 additions and 16 deletions

View file

@ -227,6 +227,7 @@ abstract class DifferentialFreeformFieldSpecification
}
$tasks = id(new ManiphestTaskQuery())
->setViewer($user)
->withTaskIDs(array_keys($tasks_statuses))
->execute();

View file

@ -98,12 +98,12 @@ final class PhabricatorDirectoryMainController
private function buildUnbreakNowPanel() {
$user = $this->getRequest()->getUser();
$user_phid = $user->getPHID();
$task_query = new ManiphestTaskQuery();
$task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN);
$task_query->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW);
$task_query->setLimit(10);
$task_query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW)
->setLimit(10);
$tasks = $task_query->execute();
@ -135,14 +135,14 @@ final class PhabricatorDirectoryMainController
assert_instances_of($projects, 'PhabricatorProject');
$user = $this->getRequest()->getUser();
$user_phid = $user->getPHID();
if ($projects) {
$task_query = new ManiphestTaskQuery();
$task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN);
$task_query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
$task_query->withAnyProjects(mpull($projects, 'getPHID'));
$task_query->setLimit(10);
$task_query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE)
->withAnyProjects(mpull($projects, 'getPHID'))
->setLimit(10);
$tasks = $task_query->execute();
} else {
$tasks = array();
@ -249,11 +249,12 @@ final class PhabricatorDirectoryMainController
$user = $this->getRequest()->getUser();
$user_phid = $user->getPHID();
$task_query = new ManiphestTaskQuery();
$task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN);
$task_query->setGroupBy(ManiphestTaskQuery::GROUP_PRIORITY);
$task_query->withOwners(array($user_phid));
$task_query->setLimit(10);
$task_query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
->setGroupBy(ManiphestTaskQuery::GROUP_PRIORITY)
->withOwners(array($user_phid))
->setLimit(10);
$tasks = $task_query->execute();

View file

@ -83,6 +83,7 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
$status = array();
$query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW)
->setLimit(1)
@ -97,6 +98,7 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
->setCount($count);
$query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
->withOwners(array($user->getPHID()))
->setLimit(1)

View file

@ -65,6 +65,8 @@ class ConduitAPI_maniphest_query_Method
protected function execute(ConduitAPIRequest $request) {
$query = new ManiphestTaskQuery();
$query->setViewer($request->getUser());
$task_ids = $request->getValue('ids');
if ($task_ids) {
$query->withTaskIDs($task_ids);

View file

@ -386,6 +386,7 @@ final class ManiphestReportController extends ManiphestController {
$query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatus(ManiphestTaskQuery::STATUS_OPEN);
$project_phid = $request->getStr('project');

View file

@ -459,6 +459,7 @@ final class ManiphestTaskListController extends ManiphestController {
ManiphestTaskPriority::getHighestPriority());
$query = new ManiphestTaskQuery();
$query->setViewer($viewer);
$query->withTaskIDs($task_ids);
if ($project_phids) {

View file

@ -154,6 +154,7 @@ final class PhabricatorProjectProfileController
$user = $this->getRequest()->getUser();
$query = id(new ManiphestTaskQuery())
->setViewer($user)
->withAnyProjects(array($project->getPHID()))
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
->setOrderBy(ManiphestTaskQuery::ORDER_PRIORITY)