@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+16 -16
+16 -16
src/applications/macro/controller/PhabricatorMacroListController.php
··· 91 91 92 92 $nav->appendChild($filter_view); 93 93 94 - 95 94 if ($macros) { 96 95 $pinboard = new PhabricatorPinboardView(); 97 96 foreach ($macros as $macro) { ··· 99 98 $file = idx($files_map, $file_phid); 100 99 101 100 $item = new PhabricatorPinboardItemView(); 102 - $item->setImageURI($file->getThumb160x120URI()); 103 - $item->setImageSize(160, 120); 104 - $item->setURI($this->getApplicationURI('/edit/'.$macro->getID().'/')); 105 - $item->setHeader($macro->getName()); 106 - 107 - if ($file->getAuthorPHID()) { 108 - $author_handle = $this->getHandle($file->getAuthorPHID()); 101 + if ($file) { 102 + $item->setImageURI($file->getThumb160x120URI()); 103 + $item->setImageSize(160, 120); 104 + if ($file->getAuthorPHID()) { 105 + $author_handle = $this->getHandle($file->getAuthorPHID()); 106 + $item->appendChild( 107 + 'Created by '.$author_handle->renderLink()); 108 + } 109 + $datetime = phabricator_date($file->getDateCreated(), $viewer); 109 110 $item->appendChild( 110 - 'Created by '.$author_handle->renderLink()); 111 - } 111 + phutil_render_tag( 112 + 'div', 113 + array(), 114 + 'Created on '.$datetime)); 112 115 113 - $datetime = phabricator_date($file->getDateCreated(), $viewer); 114 - $item->appendChild( 115 - phutil_render_tag( 116 - 'div', 117 - array(), 118 - 'Created on '.$datetime)); 116 + } 117 + $item->setURI($this->getApplicationURI('/edit/'.$macro->getID().'/')); 118 + $item->setHeader($macro->getName()); 119 119 120 120 $pinboard->addItem($item); 121 121 }