From 5f82a942c0011bf91947b2c1d627c0907bda0c92 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 15 Aug 2016 20:46:26 -0400 Subject: [PATCH] Fix PHP notice when sending overdue notifications --- ChangeLog | 4 ++++ app/Notification/MailNotification.php | 2 +- tests/units/Notification/MailNotificationTest.php | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1ef7ebd3f..a559b4ff1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ Improvements: * Show project name in task forms * Convert vanilla CSS to SASS +Bug fixes: + +* Fix PHP notice when sending overdue notifications + Version 1.0.32 -------------- diff --git a/app/Notification/MailNotification.php b/app/Notification/MailNotification.php index a5f51b89b..9e0428200 100644 --- a/app/Notification/MailNotification.php +++ b/app/Notification/MailNotification.php @@ -80,7 +80,7 @@ class MailNotification extends Base implements NotificationInterface { return sprintf( '[%s] %s', - $eventData['task']['project_name'], + isset($eventData['project_name']) ? $eventData['project_name'] : $eventData['task']['project_name'], $this->notificationModel->getTitleWithoutAuthor($eventName, $eventData) ); } diff --git a/tests/units/Notification/MailNotificationTest.php b/tests/units/Notification/MailNotificationTest.php index 05f1f8823..93eeef0c2 100644 --- a/tests/units/Notification/MailNotificationTest.php +++ b/tests/units/Notification/MailNotificationTest.php @@ -58,6 +58,11 @@ class MailNotificationTest extends Base $this->assertNotEmpty($mailNotification->getMailContent($eventName, $eventData)); $this->assertStringStartsWith('[test] ', $mailNotification->getMailSubject($eventName, $eventData)); } + + $this->assertStringStartsWith('[Test1, Test2] ', $mailNotification->getMailSubject(TaskModel::EVENT_OVERDUE, array( + 'tasks' => array(array('id' => 123), array('id' => 456)), + 'project_name' => 'Test1, Test2', + ))); } public function testSendWithEmailAddress()