From 3d12bbb17c814a0224eaaa8239a101efd663dba4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 21 Apr 2014 16:28:59 -0700 Subject: [PATCH] Minor, improve notification resiliance Summary: The token transactions can publish empty transaction feed stories. Stop them from doing that, and make notifications fail more quietly. Auditors: btrahan --- .../builder/PhabricatorNotificationBuilder.php | 7 ++++++- .../editor/PhabricatorApplicationTransactionEditor.php | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/applications/notification/builder/PhabricatorNotificationBuilder.php b/src/applications/notification/builder/PhabricatorNotificationBuilder.php index c3fa3d5426..46c73003ea 100644 --- a/src/applications/notification/builder/PhabricatorNotificationBuilder.php +++ b/src/applications/notification/builder/PhabricatorNotificationBuilder.php @@ -129,7 +129,12 @@ final class PhabricatorNotificationBuilder { $null_view = new AphrontNullView(); foreach ($stories as $story) { - $view = $story->renderView(); + try { + $view = $story->renderView(); + } catch (Exception $ex) { + // TODO: Render a nice debuggable notice instead? + continue; + } $null_view->appendChild($view->renderNotification($this->user)); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index fea78abb2a..dc43764c7d 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -2022,6 +2022,11 @@ abstract class PhabricatorApplicationTransactionEditor array $mailed_phids) { $xactions = mfilter($xactions, 'shouldHideForFeed', true); + + if (!$xactions) { + return; + } + $related_phids = $this->getFeedRelatedPHIDs($object, $xactions); $subscribed_phids = $this->getFeedNotifyPHIDs($object, $xactions);