From cfa3409712bacf802bf8f96339c462aa62f8a32a Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Mon, 25 Mar 2019 17:12:53 +0800 Subject: [PATCH] MDL-65173 message_email: removed bogus logic This reverts commit ecb4b0260e61110af011a7040a8b9c2f1112fb80. --- message/output/email/message_output_email.php | 6 +----- mod/assign/tests/locallib_test.php | 7 ------- mod/forum/tests/mail_test.php | 4 ---- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/message/output/email/message_output_email.php b/message/output/email/message_output_email.php index 96536ec5d89..1a7a222d33b 100644 --- a/message/output/email/message_output_email.php +++ b/message/output/email/message_output_email.php @@ -37,7 +37,7 @@ class message_output_email extends message_output { * @param object $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid */ function send_message($eventdata) { - global $CFG, $DB; + global $CFG; // skip any messaging suspended and deleted users if ($eventdata->userto->auth === 'nologin' or $eventdata->userto->suspended or $eventdata->userto->deleted) { @@ -93,10 +93,6 @@ class message_output_email extends message_output { $result = email_to_user($recipient, $eventdata->userfrom, $eventdata->subject, $eventdata->fullmessage, $eventdata->fullmessagehtml, $attachment, $attachname, true, $replyto, $replytoname); - if ($result && $notification = $DB->get_record('notifications', ['id' => $eventdata->savedmessageid])) { - \core_message\api::mark_notification_as_read($notification); - } - // Remove an attachment file if any. if (!empty($attachment) && file_exists($attachment)) { unlink($attachment); diff --git a/mod/assign/tests/locallib_test.php b/mod/assign/tests/locallib_test.php index 40f5e1626ac..13e0bd6c552 100644 --- a/mod/assign/tests/locallib_test.php +++ b/mod/assign/tests/locallib_test.php @@ -1678,16 +1678,9 @@ class mod_assign_locallib_testcase extends advanced_testcase { assign::cron(); $events = $sink->get_events(); - // Notification has been marked as read, so now first event should be a 'notification_viewed' one. For student. $event = reset($events); - $this->assertInstanceOf('\core\event\notification_viewed', $event); - $this->assertEquals($student->id, $event->userid); - - // And next event should be the 'notification_sent' one. For teacher. - $event = $events[1]; $this->assertInstanceOf('\core\event\notification_sent', $event); $this->assertEquals($assign->get_course()->id, $event->other['courseid']); - $this->assertEquals($teacher->id, $event->userid); $sink->close(); } diff --git a/mod/forum/tests/mail_test.php b/mod/forum/tests/mail_test.php index 33e6e080304..4ef78f2a410 100644 --- a/mod/forum/tests/mail_test.php +++ b/mod/forum/tests/mail_test.php @@ -288,11 +288,7 @@ class mod_forum_mail_testcase extends advanced_testcase { $this->helper->messagesink = $this->redirectMessages(); // Notification has been marked as read, so now first event should be a 'notification_viewed' one. $event = reset($events); - $this->assertInstanceOf('\core\event\notification_viewed', $event); - // And next event should be the 'notification_sent' one. - $event = $events[1]; - $this->assertInstanceOf('\core\event\notification_sent', $event); $this->assertEquals($course->id, $event->other['courseid']); }