1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 09:20:58 +01:00

Fix a fatal on the file info screen

Summary: D1354 added a query for a possibly-empty list -- only show the table if
there are transformations.

Test Plan: Reloaded a previously-fataling page, no fatals. Viewed a file with
transformations, got a list.

Reviewers: davidreuss, btrahan, jungejason

Reviewed By: davidreuss

CC: aran, davidreuss

Differential Revision: https://secure.phabricator.com/D1414
This commit is contained in:
epriestley 2012-01-16 06:54:08 -08:00
parent 49a59bd885
commit 025cc1376e

View file

@ -180,15 +180,18 @@ class PhabricatorFileViewController extends PhabricatorFileController {
$panel->appendChild($form); $panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setWidth(AphrontPanelView::WIDTH_FORM);
$xform_panel = null;
$transformations = id(new PhabricatorTransformedFile())->loadAllWhere( $transformations = id(new PhabricatorTransformedFile())->loadAllWhere(
'originalPHID = %s', 'originalPHID = %s',
$file->getPHID()); $file->getPHID());
if ($transformations) {
$transformed_phids = mpull($transformations, 'getTransformedPHID'); $transformed_phids = mpull($transformations, 'getTransformedPHID');
$transformed_files = id(new PhabricatorFile())->loadAllWhere( $transformed_files = id(new PhabricatorFile())->loadAllWhere(
'phid in (%Ls)', 'phid in (%Ls)',
$transformed_phids); $transformed_phids);
$transformed_map = mpull($transformed_files, null, 'getPHID'); $transformed_map = mpull($transformed_files, null, 'getPHID');
$rows = array(); $rows = array();
foreach ($transformations as $transformed) { foreach ($transformations as $transformed) {
$phid = $transformed->getTransformedPHID(); $phid = $transformed->getTransformedPHID();
@ -213,6 +216,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
$xform_panel->appendChild($table); $xform_panel->appendChild($table);
$xform_panel->setWidth(AphrontPanelView::WIDTH_FORM); $xform_panel->setWidth(AphrontPanelView::WIDTH_FORM);
$xform_panel->setHeader('Transformations'); $xform_panel->setHeader('Transformations');
}
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array($panel, $xform_panel), array($panel, $xform_panel),