Make InlineCommentQueries more robust/consistent
Summary:
Ref T13513. Improve consistency and robustness of the "InlineComment" queries.
The only real change here is that these queries now implicitly add a clause for selecting inlines ("pathID IS NULL" or "changesetID IS NULL").
Test Plan: Browed, created, edited, and submitted inlines.
Maniphest Tasks: T13513
Differential Revision: https://secure.phabricator.com/D21227
This commit is contained in:
@@ -6,6 +6,10 @@ abstract class PhabricatorDiffInlineCommentQuery
|
||||
private $fixedStates;
|
||||
private $needReplyToComments;
|
||||
|
||||
abstract protected function buildInlineCommentWhereClauseParts(
|
||||
AphrontDatabaseConnection $conn);
|
||||
abstract public function withObjectPHIDs(array $phids);
|
||||
|
||||
public function withFixedStates(array $states) {
|
||||
$this->fixedStates = $states;
|
||||
return $this;
|
||||
@@ -16,14 +20,19 @@ abstract class PhabricatorDiffInlineCommentQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function buildWhereClauseComponents(
|
||||
AphrontDatabaseConnection $conn_r) {
|
||||
$where = parent::buildWhereClauseComponents($conn_r);
|
||||
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
||||
$where = parent::buildWhereClauseParts($conn);
|
||||
$alias = $this->getPrimaryTableAlias();
|
||||
|
||||
foreach ($this->buildInlineCommentWhereClauseParts($conn) as $part) {
|
||||
$where[] = $part;
|
||||
}
|
||||
|
||||
if ($this->fixedStates !== null) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'fixedState IN (%Ls)',
|
||||
$conn,
|
||||
'%T.fixedState IN (%Ls)',
|
||||
$alias,
|
||||
$this->fixedStates);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user