mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-57755_master' of https://github.com/t-schroeder/moodle
This commit is contained in:
commit
2aa92150a6
1 changed files with 11 additions and 18 deletions
|
@ -331,15 +331,14 @@ 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) {
|
||||
$savemessage->timeread = null;
|
||||
\core_message\api::mark_notification_as_read($savemessage);
|
||||
} else {
|
||||
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
|
||||
}
|
||||
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 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,15 +382,9 @@ 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 {
|
||||
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
|
||||
}
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue