mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
Avoid fatal if a macro has no file
Summary: Not sure how this triggers, but we have a macro that has no file associated with it, and this caused a fatal on the /macro endpoint. Test Plan: https://phabricator.fb.com/macro/?page=100 Reviewers: vrana, nh, epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D3642
This commit is contained in:
parent
7c0f0807da
commit
1fda844c9f
1 changed files with 16 additions and 16 deletions
|
@ -91,7 +91,6 @@ final class PhabricatorMacroListController
|
|||
|
||||
$nav->appendChild($filter_view);
|
||||
|
||||
|
||||
if ($macros) {
|
||||
$pinboard = new PhabricatorPinboardView();
|
||||
foreach ($macros as $macro) {
|
||||
|
@ -99,17 +98,14 @@ final class PhabricatorMacroListController
|
|||
$file = idx($files_map, $file_phid);
|
||||
|
||||
$item = new PhabricatorPinboardItemView();
|
||||
if ($file) {
|
||||
$item->setImageURI($file->getThumb160x120URI());
|
||||
$item->setImageSize(160, 120);
|
||||
$item->setURI($this->getApplicationURI('/edit/'.$macro->getID().'/'));
|
||||
$item->setHeader($macro->getName());
|
||||
|
||||
if ($file->getAuthorPHID()) {
|
||||
$author_handle = $this->getHandle($file->getAuthorPHID());
|
||||
$item->appendChild(
|
||||
'Created by '.$author_handle->renderLink());
|
||||
}
|
||||
|
||||
$datetime = phabricator_date($file->getDateCreated(), $viewer);
|
||||
$item->appendChild(
|
||||
phutil_render_tag(
|
||||
|
@ -117,6 +113,10 @@ final class PhabricatorMacroListController
|
|||
array(),
|
||||
'Created on '.$datetime));
|
||||
|
||||
}
|
||||
$item->setURI($this->getApplicationURI('/edit/'.$macro->getID().'/'));
|
||||
$item->setHeader($macro->getName());
|
||||
|
||||
$pinboard->addItem($item);
|
||||
}
|
||||
$nav->appendChild($pinboard);
|
||||
|
|
Loading…
Reference in a new issue