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

This commit is contained in:
Simon Mok 2020-10-12 19:30:02 +08:00
parent 46f977a8bf
commit bf17107882
2 changed files with 5 additions and 0 deletions

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['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['maxareabytes'] = 'The file is larger than the space remaining in this area.';
$string['messagingdisable'] = 'Messaging is disabled on this site'; $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['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['mimetexnotexecutable'] = 'Custom mimetex is not executable!';
$string['missingfield'] = 'Field "{$a}" is missing'; $string['missingfield'] = 'Field "{$a}" is missing';

View file

@ -1699,6 +1699,10 @@ class api {
$messageid = message_send($eventdata); $messageid = message_send($eventdata);
if (!$messageid) {
throw new \moodle_exception('messageundeliveredbynotificationsettings', 'moodle');
}
$messagerecord = $DB->get_record('messages', ['id' => $messageid], 'id, useridfrom, fullmessage, $messagerecord = $DB->get_record('messages', ['id' => $messageid], 'id, useridfrom, fullmessage,
timecreated, fullmessagetrust'); timecreated, fullmessagetrust');
$message = (object) [ $message = (object) [