Differential D12484 Diff 29994 src/applications/differential/query/DifferentialInlineCommentQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/query/DifferentialInlineCommentQuery.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Temporary wrapper for transitioning Differential to ApplicationTransactions. | * Temporary wrapper for transitioning Differential to ApplicationTransactions. | ||||
| */ | */ | ||||
| final class DifferentialInlineCommentQuery | final class DifferentialInlineCommentQuery | ||||
| extends PhabricatorOffsetPagedQuery { | extends PhabricatorOffsetPagedQuery { | ||||
| // TODO: Remove this when this query eventually moves to PolicyAware. | // TODO: Remove this when this query eventually moves to PolicyAware. | ||||
| private $viewer; | private $viewer; | ||||
| private $ids; | private $ids; | ||||
| private $phids; | private $phids; | ||||
| private $drafts; | private $drafts; | ||||
| private $authorPHIDs; | private $authorPHIDs; | ||||
| private $changesetIDs; | |||||
| private $revisionPHIDs; | private $revisionPHIDs; | ||||
| private $deletedDrafts; | private $deletedDrafts; | ||||
| public function setViewer(PhabricatorUser $viewer) { | public function setViewer(PhabricatorUser $viewer) { | ||||
| $this->viewer = $viewer; | $this->viewer = $viewer; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| Show All 16 Lines | public function withDrafts($drafts) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withAuthorPHIDs(array $author_phids) { | public function withAuthorPHIDs(array $author_phids) { | ||||
| $this->authorPHIDs = $author_phids; | $this->authorPHIDs = $author_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withChangesetIDs(array $ids) { | |||||
| $this->changesetIDs = $ids; | |||||
| return $this; | |||||
| } | |||||
| public function withRevisionPHIDs(array $revision_phids) { | public function withRevisionPHIDs(array $revision_phids) { | ||||
| $this->revisionPHIDs = $revision_phids; | $this->revisionPHIDs = $revision_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withDeletedDrafts($deleted_drafts) { | public function withDeletedDrafts($deleted_drafts) { | ||||
| $this->deletedDrafts = $deleted_drafts; | $this->deletedDrafts = $deleted_drafts; | ||||
| return $this; | return $this; | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | ||||
| if ($this->revisionPHIDs !== null) { | if ($this->revisionPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'revisionPHID IN (%Ls)', | 'revisionPHID IN (%Ls)', | ||||
| $this->revisionPHIDs); | $this->revisionPHIDs); | ||||
| } | } | ||||
| if ($this->changesetIDs !== null) { | |||||
| $where[] = qsprintf( | |||||
| $conn_r, | |||||
| 'changesetID IN (%Ld)', | |||||
| $this->changesetIDs); | |||||
| } | |||||
| if ($this->drafts === null) { | if ($this->drafts === null) { | ||||
| if ($this->deletedDrafts) { | if ($this->deletedDrafts) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| '(authorPHID = %s) OR (transactionPHID IS NOT NULL)', | '(authorPHID = %s) OR (transactionPHID IS NOT NULL)', | ||||
| $this->getViewer()->getPHID()); | $this->getViewer()->getPHID()); | ||||
| } else { | } else { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| Show All 20 Lines | |||||