From f24ae96bb6e02ceb3123b2bfe6eb218e36915c41 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 17 Dec 2014 09:42:37 -0800 Subject: [PATCH] Pholio - fix show older transactions for if there are inline comments Summary: We didn't load enough data for this case for the custom view class Pholio uses. Fixes T6770. Re-jiggers the signature of the loadImages function in the PholioMockQuery to get there so as to not duplicate any business logic. Test Plan: made a pholio mock with lots of inline comments. pre-patch "show older" fatals and post-patch "show older" works Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6770 Differential Revision: https://secure.phabricator.com/D11002 --- src/applications/pholio/query/PholioMockQuery.php | 11 +++++++---- src/applications/pholio/storage/PholioMock.php | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/applications/pholio/query/PholioMockQuery.php b/src/applications/pholio/query/PholioMockQuery.php index e4553c1b75..d80bf57a28 100644 --- a/src/applications/pholio/query/PholioMockQuery.php +++ b/src/applications/pholio/query/PholioMockQuery.php @@ -68,7 +68,7 @@ final class PholioMockQuery $mocks = $table->loadAllFromArray($data); if ($mocks && $this->needImages) { - $this->loadImages($mocks); + self::loadImages($this->getViewer(), $mocks, $this->needInlineComments); } if ($mocks && $this->needCoverFiles) { @@ -118,15 +118,18 @@ final class PholioMockQuery return $this->formatWhereClause($where); } - private function loadImages(array $mocks) { + public static function loadImages( + PhabricatorUser $viewer, + array $mocks, + $need_inline_comments) { assert_instances_of($mocks, 'PholioMock'); $mock_map = mpull($mocks, null, 'getID'); $all_images = id(new PholioImageQuery()) - ->setViewer($this->getViewer()) + ->setViewer($viewer) ->setMockCache($mock_map) ->withMockIDs(array_keys($mock_map)) - ->needInlineComments($this->needInlineComments) + ->needInlineComments($need_inline_comments) ->execute(); $image_groups = mgroup($all_images, 'getMockID'); diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php index bea0f3ceb8..24648c2232 100644 --- a/src/applications/pholio/storage/PholioMock.php +++ b/src/applications/pholio/storage/PholioMock.php @@ -268,6 +268,10 @@ final class PholioMock extends PholioDAO PhabricatorApplicationTransactionView $timeline, AphrontRequest $request) { + PholioMockQuery::loadImages( + $request->getUser(), + array($this), + $need_inline_comments = true); $timeline->setMock($this); return $timeline; }