mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
Merge branch 'MDL-70552-master' of git://github.com/ilyatregubov/moodle
This commit is contained in:
commit
a72ea10b84
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user