From d0da409eb0f8dad2420709e90d1af26e6fdd0284 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 24 Jun 2013 07:42:37 -0700 Subject: [PATCH] Fix a mistakenly translated query from D6262 Summary: Ref T2222. I didn't translate this query properly; reproduce the original. Test Plan: When viewing a revision with non-draft inline comments by a user other than the viewer, the inline comments now appear on the changesets themselves. Reviewers: kawakami, btrahan, garoevans Reviewed By: garoevans CC: aran, mbishopim3 Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D6281 --- .../DifferentialChangesetViewController.php | 2 +- .../query/DifferentialInlineCommentQuery.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index 0ef1ed0bd5..5ebc988c70 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -269,7 +269,7 @@ final class DifferentialChangesetViewController extends DifferentialController { } return id(new DifferentialInlineCommentQuery()) - ->withAuthorAndChangesetIDs($author_phid, $changeset_ids) + ->withViewerAndChangesetIDs($author_phid, $changeset_ids) ->execute(); } diff --git a/src/applications/differential/query/DifferentialInlineCommentQuery.php b/src/applications/differential/query/DifferentialInlineCommentQuery.php index 12191fa79a..49e0303d7f 100644 --- a/src/applications/differential/query/DifferentialInlineCommentQuery.php +++ b/src/applications/differential/query/DifferentialInlineCommentQuery.php @@ -11,7 +11,7 @@ final class DifferentialInlineCommentQuery private $ids; private $commentIDs; - private $authorAndChangesetIDs; + private $viewerAndChangesetIDs; private $draftComments; private $draftsByAuthors; @@ -35,8 +35,8 @@ final class DifferentialInlineCommentQuery return $this; } - public function withAuthorAndChangesetIDs($author_phid, array $ids) { - $this->authorAndChangesetIDs = array($author_phid, $ids); + public function withViewerAndChangesetIDs($author_phid, array $ids) { + $this->viewerAndChangesetIDs = array($author_phid, $ids); return $this; } @@ -98,13 +98,13 @@ final class DifferentialInlineCommentQuery $this->commentIDs); } - if ($this->authorAndChangesetIDs) { - list($phid, $ids) = $this->authorAndChangesetIDs; + if ($this->viewerAndChangesetIDs) { + list($phid, $ids) = $this->viewerAndChangesetIDs; $where[] = qsprintf( $conn_r, - 'authorPHID = %s AND changesetID IN (%Ld)', - $phid, - $ids); + 'changesetID IN (%Ld) AND (authorPHID = %s OR commentID IS NOT NULL)', + $ids, + $phid); } if ($this->draftComments) {