Use didRejectResult() when querying workboard columns

Summary: Fixes T9250. Ref T4345.

Test Plan:
Faked a policy error:

{F748975}

Reviewers: joshuaspence, chad

Reviewed By: chad

Maniphest Tasks: T4345, T9250

Differential Revision: https://secure.phabricator.com/D13981
This commit is contained in:
epriestley 2015-08-23 08:31:53 -07:00
parent 459e0d2fa3
commit 9e3f3e692d

View file

@ -28,19 +28,12 @@ final class PhabricatorProjectColumnQuery
return $this; return $this;
} }
public function newResultObject() {
return new PhabricatorProjectColumn();
}
protected function loadPage() { protected function loadPage() {
$table = new PhabricatorProjectColumn(); return $this->loadStandardPage($this->newResultObject());
$conn_r = $table->establishConnection('r');
$data = queryfx_all(
$conn_r,
'SELECT * FROM %T %Q %Q %Q',
$table->getTableName(),
$this->buildWhereClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
return $table->loadAllFromArray($data);
} }
protected function willFilterPage(array $page) { protected function willFilterPage(array $page) {
@ -60,6 +53,7 @@ final class PhabricatorProjectColumnQuery
$phid = $column->getProjectPHID(); $phid = $column->getProjectPHID();
$project = idx($projects, $phid); $project = idx($projects, $phid);
if (!$project) { if (!$project) {
$this->didRejectResult($page[$key]);
unset($page[$key]); unset($page[$key]);
continue; continue;
} }
@ -69,40 +63,38 @@ final class PhabricatorProjectColumnQuery
return $page; return $page;
} }
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = array(); $where = parent::buildWhereClauseParts($conn);
if ($this->ids) { if ($this->ids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn,
'id IN (%Ld)', 'id IN (%Ld)',
$this->ids); $this->ids);
} }
if ($this->phids) { if ($this->phids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn,
'phid IN (%Ls)', 'phid IN (%Ls)',
$this->phids); $this->phids);
} }
if ($this->projectPHIDs) { if ($this->projectPHIDs !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn,
'projectPHID IN (%Ls)', 'projectPHID IN (%Ls)',
$this->projectPHIDs); $this->projectPHIDs);
} }
if ($this->statuses !== null) { if ($this->statuses !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn,
'status IN (%Ld)', 'status IN (%Ld)',
$this->statuses); $this->statuses);
} }
$where[] = $this->buildPagingClause($conn_r); return $where;
return $this->formatWhereClause($where);
} }
public function getQueryApplicationClass() { public function getQueryApplicationClass() {