MDL-70552 core_message: Show popup for teachers when anonymous

user completed feedback.
This commit is contained in:
Ilya Tregubov 2021-01-13 09:38:45 +02:00
parent a2fda1289f
commit d208bc5353
3 changed files with 15 additions and 5 deletions

View file

@ -49,12 +49,15 @@ class message_output_popup extends message_output {
global $DB;
// Prevent users from getting popup notifications from themselves (happens with forum notifications).
if ($eventdata->userfrom->id != $eventdata->userto->id && $eventdata->notification) {
if (!$DB->record_exists('message_popup_notifications', ['notificationid' => $eventdata->savedmessageid])) {
$record = new stdClass();
$record->notificationid = $eventdata->savedmessageid;
if ($eventdata->notification) {
if (($eventdata->userfrom->id != $eventdata->userto->id) ||
(isset($eventdata->anonymous) && $eventdata->anonymous)) {
if (!$DB->record_exists('message_popup_notifications', ['notificationid' => $eventdata->savedmessageid])) {
$record = new stdClass();
$record->notificationid = $eventdata->savedmessageid;
$DB->insert_record('message_popup_notifications', $record);
$DB->insert_record('message_popup_notifications', $record);
}
}
}