1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

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
This commit is contained in:
epriestley 2016-06-09 08:17:15 -07:00
parent e808963eae
commit 3b1c6073a5

View file

@ -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');
}