mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +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:
parent
49a59bd885
commit
025cc1376e
1 changed files with 32 additions and 28 deletions
|
@ -180,40 +180,44 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
|||
$panel->appendChild($form);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
|
||||
$xform_panel = null;
|
||||
|
||||
$transformations = id(new PhabricatorTransformedFile())->loadAllWhere(
|
||||
'originalPHID = %s',
|
||||
$file->getPHID());
|
||||
$transformed_phids = mpull($transformations, 'getTransformedPHID');
|
||||
$transformed_files = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid in (%Ls)',
|
||||
$transformed_phids);
|
||||
$transformed_map = mpull($transformed_files, null, 'getPHID');
|
||||
$rows = array();
|
||||
foreach ($transformations as $transformed) {
|
||||
$phid = $transformed->getTransformedPHID();
|
||||
$rows[] = array(
|
||||
phutil_escape_html($transformed->getTransform()),
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $transformed_map[$phid]->getBestURI(),
|
||||
),
|
||||
$phid));
|
||||
if ($transformations) {
|
||||
$transformed_phids = mpull($transformations, 'getTransformedPHID');
|
||||
$transformed_files = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid in (%Ls)',
|
||||
$transformed_phids);
|
||||
$transformed_map = mpull($transformed_files, null, 'getPHID');
|
||||
|
||||
$rows = array();
|
||||
foreach ($transformations as $transformed) {
|
||||
$phid = $transformed->getTransformedPHID();
|
||||
$rows[] = array(
|
||||
phutil_escape_html($transformed->getTransform()),
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $transformed_map[$phid]->getBestURI(),
|
||||
),
|
||||
$phid));
|
||||
}
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'Transform',
|
||||
'File',
|
||||
));
|
||||
|
||||
$xform_panel = new AphrontPanelView();
|
||||
$xform_panel->appendChild($table);
|
||||
$xform_panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$xform_panel->setHeader('Transformations');
|
||||
}
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'Transform',
|
||||
'File',
|
||||
));
|
||||
|
||||
$xform_panel = new AphrontPanelView();
|
||||
$xform_panel->appendChild($table);
|
||||
$xform_panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$xform_panel->setHeader('Transformations');
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array($panel, $xform_panel),
|
||||
array(
|
||||
|
|
Loading…
Reference in a new issue