1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Maniphest - fix fatal in custom query for users with no projects

Summary: See https://github.com/facebook/phabricator/issues/380 for report.

Test Plan: Maniphest -> Custom Query -> Put user with no project in "Any User Projects" field -> Search : observe no fatal

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6862
This commit is contained in:
Bob Trahan 2013-09-02 13:24:41 -07:00
parent cf13885736
commit 83e0380046

View file

@ -201,8 +201,26 @@ final class ManiphestTaskQuery extends PhabricatorQuery {
return $this; return $this;
} }
/**
* This is a wrapper until we finish T603. The newer query class this class
* will inherit from handles catching this exception already.
*/
public function execute() { public function execute() {
try {
$result = $this->executeManiphestQuery();
} catch (PhabricatorEmptyQueryException $ex) {
$result = array();
if ($this->calculateRows) {
$this->rowCount = 0;
}
}
return $result;
}
private function executeManiphestQuery() {
$task_dao = new ManiphestTask(); $task_dao = new ManiphestTask();
$conn = $task_dao->establishConnection('r'); $conn = $task_dao->establishConnection('r');
@ -505,6 +523,9 @@ final class ManiphestTaskQuery extends PhabricatorQuery {
->withMemberPHIDs($this->anyUserProjectPHIDs) ->withMemberPHIDs($this->anyUserProjectPHIDs)
->execute(); ->execute();
$any_user_project_phids = mpull($projects, 'getPHID'); $any_user_project_phids = mpull($projects, 'getPHID');
if (!$any_user_project_phids) {
throw new PhabricatorEmptyQueryException();
}
return qsprintf( return qsprintf(
$conn, $conn,