Merge branch 'MDL-57755_master' of https://github.com/t-schroeder/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2020-01-28 10:26:32 +01:00
commit 2aa92150a6

View file

@ -331,16 +331,15 @@ class manager {
// Trigger event for sending a message or notification - we need to do this before marking as read!
self::trigger_message_events($eventdata, $savemessage);
if ($eventdata->notification or empty($CFG->messaging)) {
// If they have deselected all processors and its a notification mark it read. The user doesn't want to be bothered.
// The same goes if the messaging is completely disabled.
if ($eventdata->notification) {
// If they have deselected all processors and it's a notification mark it read. The user doesn't want to be
// bothered.
$savemessage->timeread = null;
\core_message\api::mark_notification_as_read($savemessage);
} else {
} else if (empty($CFG->messaging)) {
// If it's a message and messaging is disabled mark it read.
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
}
}
return $savemessage->id;
}
@ -383,16 +382,10 @@ class manager {
// Trigger event for sending a message or notification - we need to do this before marking as read!
self::trigger_message_events($eventdata, $savemessage);
if (empty($CFG->messaging)) {
// If they have deselected all processors and its a notification mark it read. The user doesn't want to be bothered.
// The same goes if the messaging is completely disabled.
if ($eventdata->notification) {
$savemessage->timeread = null;
\core_message\api::mark_notification_as_read($savemessage);
} else {
if (!$eventdata->notification && empty($CFG->messaging)) {
// If it's a message and messaging is disabled mark it read.
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
}
}
return $savemessage->id;
}