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!
|
// Trigger event for sending a message or notification - we need to do this before marking as read!
|
||||||
self::trigger_message_events($eventdata, $savemessage);
|
self::trigger_message_events($eventdata, $savemessage);
|
||||||
|
|
||||||
if ($eventdata->notification or empty($CFG->messaging)) {
|
if ($eventdata->notification) {
|
||||||
// If they have deselected all processors and its a notification mark it read. The user doesn't want to be bothered.
|
// If they have deselected all processors and it's a notification mark it read. The user doesn't want to be
|
||||||
// The same goes if the messaging is completely disabled.
|
// bothered.
|
||||||
if ($eventdata->notification) {
|
$savemessage->timeread = null;
|
||||||
$savemessage->timeread = null;
|
\core_message\api::mark_notification_as_read($savemessage);
|
||||||
\core_message\api::mark_notification_as_read($savemessage);
|
} else if (empty($CFG->messaging)) {
|
||||||
} else {
|
// If it's a message and messaging is disabled mark it read.
|
||||||
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
|
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $savemessage->id;
|
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!
|
// Trigger event for sending a message or notification - we need to do this before marking as read!
|
||||||
self::trigger_message_events($eventdata, $savemessage);
|
self::trigger_message_events($eventdata, $savemessage);
|
||||||
|
|
||||||
if (empty($CFG->messaging)) {
|
if (!$eventdata->notification && empty($CFG->messaging)) {
|
||||||
// If they have deselected all processors and its a notification mark it read. The user doesn't want to be bothered.
|
// If it's a message and messaging is disabled mark it read.
|
||||||
// The same goes if the messaging is completely disabled.
|
\core_message\api::mark_message_as_read($eventdata->userto->id, $savemessage);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $savemessage->id;
|
return $savemessage->id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue