From 3b1c6073a59339f13d2933d1e7a0fea6004fbccf Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 9 Jun 2016 08:17:15 -0700 Subject: [PATCH] Don't include other users' unpublished drafts when counting Pholio inlines Summary: Fixes T10886. This should get more formal some day, but just fix it for now. Test Plan: Reloaded mock with other unpublished draft inlines, saw accurate count. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10886 Differential Revision: https://secure.phabricator.com/D16087 --- src/applications/pholio/query/PholioImageQuery.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/applications/pholio/query/PholioImageQuery.php b/src/applications/pholio/query/PholioImageQuery.php index 2d5057ccdc..8c722660cb 100644 --- a/src/applications/pholio/query/PholioImageQuery.php +++ b/src/applications/pholio/query/PholioImageQuery.php @@ -137,9 +137,12 @@ final class PholioImageQuery $all_files = mpull($all_files, null, 'getPHID'); if ($this->needInlineComments) { - $all_inline_comments = id(new PholioTransactionComment()) - ->loadAllWhere('imageid IN (%Ld)', - mpull($images, 'getID')); + // Only load inline comments the viewer has permission to see. + $all_inline_comments = id(new PholioTransactionComment())->loadAllWhere( + 'imageID IN (%Ld) + AND (transactionPHID IS NOT NULL OR authorPHID = %s)', + mpull($images, 'getID'), + $this->getViewer()->getPHID()); $all_inline_comments = mgroup($all_inline_comments, 'getImageID'); }