Differential D19789 Diff 47256 src/applications/differential/query/DifferentialInlineCommentQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/query/DifferentialInlineCommentQuery.php
| Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | public function execute() { | ||||
| return $comments; | return $comments; | ||||
| } | } | ||||
| public function executeOne() { | public function executeOne() { | ||||
| // TODO: Remove when this query moves to PolicyAware. | // TODO: Remove when this query moves to PolicyAware. | ||||
| return head($this->execute()); | return head($this->execute()); | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = array(); | ||||
| // Only find inline comments. | // Only find inline comments. | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'changesetID IS NOT NULL'); | 'changesetID IS NOT NULL'); | ||||
| if ($this->ids !== null) { | if ($this->ids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'id IN (%Ld)', | 'id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids !== null) { | if ($this->phids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'phid IN (%Ls)', | 'phid IN (%Ls)', | ||||
| $this->phids); | $this->phids); | ||||
| } | } | ||||
| if ($this->revisionPHIDs !== null) { | if ($this->revisionPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'revisionPHID IN (%Ls)', | 'revisionPHID IN (%Ls)', | ||||
| $this->revisionPHIDs); | $this->revisionPHIDs); | ||||
| } | } | ||||
| if ($this->drafts === null) { | if ($this->drafts === null) { | ||||
| if ($this->deletedDrafts) { | if ($this->deletedDrafts) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| '(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( | ||||
| $conn_r, | $conn, | ||||
| '(authorPHID = %s AND isDeleted = 0) | '(authorPHID = %s AND isDeleted = 0) | ||||
| OR (transactionPHID IS NOT NULL)', | OR (transactionPHID IS NOT NULL)', | ||||
| $this->getViewer()->getPHID()); | $this->getViewer()->getPHID()); | ||||
| } | } | ||||
| } else if ($this->drafts) { | } else if ($this->drafts) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| '(authorPHID = %s AND isDeleted = 0) AND (transactionPHID IS NULL)', | '(authorPHID = %s AND isDeleted = 0) AND (transactionPHID IS NULL)', | ||||
| $this->getViewer()->getPHID()); | $this->getViewer()->getPHID()); | ||||
| } else { | } else { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'transactionPHID IS NOT NULL'); | 'transactionPHID IS NOT NULL'); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
| } | } | ||||
| public function adjustInlinesForChangesets( | public function adjustInlinesForChangesets( | ||||
| array $inlines, | array $inlines, | ||||
| array $old, | array $old, | ||||
| array $new, | array $new, | ||||
| DifferentialRevision $revision) { | DifferentialRevision $revision) { | ||||
| ▲ Show 20 Lines • Show All 312 Lines • Show Last 20 Lines | |||||