MDL-68070 messaging: Fix error when personal notification is disabled

This commit is contained in:
Simon Mok
2020-10-13 23:40:46 +02:00
committed by Eloy Lafuente (stronk7)
parent c3299761f7
commit 1a7928173b
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -391,6 +391,7 @@ $string['loginasonecourse'] = 'You cannot enter this course.<br /> You have to t
$string['maxbytesfile'] = 'The file {$a->file} is too large. The maximum size you can upload is {$a->size}.';
$string['maxareabytes'] = 'The file is larger than the space remaining in this area.';
$string['messagingdisable'] = 'Messaging is disabled on this site';
$string['messageundeliveredbynotificationsettings'] = 'Message failed to deliver. Please check the notification settings.';
$string['mimetexisnotexist'] = 'Your system is not configured to run mimeTeX. You need to obtain the C source from <a href="https://www.forkosh.com/mimetex.zip">https://www.forkosh.com/mimetex.zip</a>, compile it and put the executable into your moodle/filter/tex/ directory.';
$string['mimetexnotexecutable'] = 'Custom mimetex is not executable!';
$string['missingfield'] = 'Field "{$a}" is missing';
+4
View File
@@ -1699,6 +1699,10 @@ class api {
$messageid = message_send($eventdata);
if (!$messageid) {
throw new \moodle_exception('messageundeliveredbynotificationsettings', 'moodle');
}
$messagerecord = $DB->get_record('messages', ['id' => $messageid], 'id, useridfrom, fullmessage,
timecreated, fullmessagetrust');
$message = (object) [