Skip to content

Commit

Permalink
MDL-68070 messaging: Fix error when personal notification is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmok committed Oct 12, 2020
1 parent 46f977a commit bf17107
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lang/en/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
$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';
Expand Down
4 changes: 4 additions & 0 deletions message/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,10 @@ public static function send_message_to_conversation(int $userid, int $conversati

$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) [
Expand Down

0 comments on commit bf17107

Please sign in to comment.