1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 16:00:59 +01:00

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
This commit is contained in:
Bob Trahan 2014-12-17 09:42:37 -08:00
parent ed4c7893e9
commit f24ae96bb6
2 changed files with 11 additions and 4 deletions
src/applications/pholio

View file

@ -68,7 +68,7 @@ final class PholioMockQuery
$mocks = $table->loadAllFromArray($data); $mocks = $table->loadAllFromArray($data);
if ($mocks && $this->needImages) { if ($mocks && $this->needImages) {
$this->loadImages($mocks); self::loadImages($this->getViewer(), $mocks, $this->needInlineComments);
} }
if ($mocks && $this->needCoverFiles) { if ($mocks && $this->needCoverFiles) {
@ -118,15 +118,18 @@ final class PholioMockQuery
return $this->formatWhereClause($where); 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'); assert_instances_of($mocks, 'PholioMock');
$mock_map = mpull($mocks, null, 'getID'); $mock_map = mpull($mocks, null, 'getID');
$all_images = id(new PholioImageQuery()) $all_images = id(new PholioImageQuery())
->setViewer($this->getViewer()) ->setViewer($viewer)
->setMockCache($mock_map) ->setMockCache($mock_map)
->withMockIDs(array_keys($mock_map)) ->withMockIDs(array_keys($mock_map))
->needInlineComments($this->needInlineComments) ->needInlineComments($need_inline_comments)
->execute(); ->execute();
$image_groups = mgroup($all_images, 'getMockID'); $image_groups = mgroup($all_images, 'getMockID');

View file

@ -268,6 +268,10 @@ final class PholioMock extends PholioDAO
PhabricatorApplicationTransactionView $timeline, PhabricatorApplicationTransactionView $timeline,
AphrontRequest $request) { AphrontRequest $request) {
PholioMockQuery::loadImages(
$request->getUser(),
array($this),
$need_inline_comments = true);
$timeline->setMock($this); $timeline->setMock($this);
return $timeline; return $timeline;
} }