From 1077e7a80c44ba438cd849b723293999d053e7b0 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 29 Jan 2015 14:35:22 -0800 Subject: [PATCH] Application Emails - conditionally pass around the application email Summary: due to typehints, passing null is going to barf here. Ref D11564, ref T5039. Test Plan: made an edit to a task from the web ui and it didnt fatal Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T5039 Differential Revision: https://secure.phabricator.com/D11571 --- .../maniphest/mail/ManiphestCreateMailReceiver.php | 4 +++- src/applications/maniphest/mail/ManiphestReplyHandler.php | 8 +++++--- .../editor/PhabricatorApplicationTransactionEditor.php | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php b/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php index bea3a4f24e..f654ea9a05 100644 --- a/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php +++ b/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php @@ -41,7 +41,9 @@ final class ManiphestCreateMailReceiver extends PhabricatorMailReceiver { $handler->setActor($sender); $handler->setExcludeMailRecipientPHIDs( $mail->loadExcludeMailRecipientPHIDs()); - $handler->setApplicationEmail($this->getApplicationEmail()); + if ($this->getApplicationEmail()) { + $handler->setApplicationEmail($this->getApplicationEmail()); + } $handler->processEmail($mail); $mail->setRelatedPHID($task->getPHID()); diff --git a/src/applications/maniphest/mail/ManiphestReplyHandler.php b/src/applications/maniphest/mail/ManiphestReplyHandler.php index 7c06804d9e..c853c0f8ec 100644 --- a/src/applications/maniphest/mail/ManiphestReplyHandler.php +++ b/src/applications/maniphest/mail/ManiphestReplyHandler.php @@ -170,9 +170,11 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler { ->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs()) ->setContinueOnNoEffect(true) ->setContinueOnMissingFields(true) - ->setContentSource($content_source) - ->setApplicationEmail($this->getApplicationEmail()) - ->applyTransactions($task, $xactions); + ->setContentSource($content_source); + if ($this->getApplicationEmail()) { + $editor->setApplicationEmail($this->getApplicationEmail()); + } + $editor->applyTransactions($task, $xactions); $event = new PhabricatorEvent( PhabricatorEventType::TYPE_MANIPHEST_DIDEDITTASK, diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index dcde28f19e..c8154dff7c 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -2438,7 +2438,9 @@ abstract class PhabricatorApplicationTransactionEditor $adapter = $this->buildHeraldAdapter($object, $xactions); $adapter->setContentSource($this->getContentSource()); $adapter->setIsNewObject($this->getIsNewObject()); - $adapter->setApplicationEmail($this->getApplicationEmail()); + if ($this->getApplicationEmail()) { + $adapter->setApplicationEmail($this->getApplicationEmail()); + } $xscript = HeraldEngine::loadAndApplyRules($adapter); $this->setHeraldAdapter($adapter);