MDL-65173 message_email: removed bogus logic

This reverts commit ecb4b0260e.
This commit is contained in:
Mark Nelson
2019-03-25 17:19:27 +08:00
parent d70651f787
commit cfa3409712
3 changed files with 1 additions and 16 deletions
@@ -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);
-7
View File
@@ -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();
}
-4
View File
@@ -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']);
}