Merge branch 'MDL-70552-master' of git://github.com/ilyatregubov/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2021-02-17 10:26:20 +01:00
commit a72ea10b84
3 changed files with 15 additions and 5 deletions

View File

@ -132,6 +132,9 @@ class message {
/** @var mixed Custom data to be passed to the message processor. Must be serialisable using json_encode(). */
private $customdata;
/** @var boolean If message is anonymous. */
private $anonymous;
/** @var array a list of properties that is allowed for each message. */
private $properties = array(
'courseid',
@ -158,6 +161,7 @@ class message {
'timecreated',
'fullmessagetrust',
'customdata',
'anonymous',
);
/** @var array property to store any additional message processor specific content */

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);
}
}
}

View File

@ -2639,6 +2639,7 @@ function feedback_send_email($cm, $feedback, $course, $user, $completed = null)
];
if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
$eventdata = new \core\message\message();
$eventdata->anonymous = false;
$eventdata->courseid = $course->id;
$eventdata->name = 'submission';
$eventdata->component = 'mod_feedback';
@ -2661,6 +2662,7 @@ function feedback_send_email($cm, $feedback, $course, $user, $completed = null)
message_send($eventdata);
} else {
$eventdata = new \core\message\message();
$eventdata->anonymous = true;
$eventdata->courseid = $course->id;
$eventdata->name = 'submission';
$eventdata->component = 'mod_feedback';
@ -2726,6 +2728,7 @@ function feedback_send_email_anonym($cm, $feedback, $course) {
}
$eventdata = new \core\message\message();
$eventdata->anonymous = true;
$eventdata->courseid = $course->id;
$eventdata->name = 'submission';
$eventdata->component = 'mod_feedback';