Merge branch 'MDL-65968-master' of git://github.com/jleyva/moodle

This commit is contained in:
Jun Pataleta 2019-09-24 12:01:10 +08:00
commit 844d27b2cd
10 changed files with 11 additions and 0 deletions

View File

@ -133,6 +133,7 @@ function core_competency_comment_add($comment, $params) {
$message->contexturlname = $urlname;
$userpicture = new \user_picture($user);
$userpicture->size = 1; // Use f1 size.
// Message each recipient.
foreach ($recipients as $recipient) {
$msgcopy = clone($message);
@ -208,6 +209,7 @@ function core_competency_comment_add($comment, $params) {
$message->contexturlname = $urlname;
$userpicture = new \user_picture($user);
$userpicture->size = 1; // Use f1 size.
// Message each recipient.
foreach ($recipients as $recipient) {
$msgcopy = clone($message);

View File

@ -101,6 +101,7 @@ class core_competency_lib_testcase extends advanced_testcase {
$this->assertObjectHasAttribute('notificationiconurl', $customdata);
$this->assertContains('tokenpluginfile.php', $customdata->notificationiconurl);
$userpicture = new \user_picture($u1);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $u2->id;
$this->assertEquals($userpicture->get_url($PAGE)->out(false), $customdata->notificationiconurl);

View File

@ -2676,6 +2676,7 @@ class api {
$message->smallmessage = '';
$message->contexturl = $url->out(false);
$userpicture = new \user_picture($userfrom);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $userto->id; // Generate an out-of-session token for the user receiving the message.
$message->customdata = [
'notificationiconurl' => $userpicture->get_url($PAGE)->out(false),

View File

@ -353,6 +353,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
$eventdata->notification = 0;
// User image.
$userpicture = new user_picture($userfrom);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $userto->id; // Generate an out-of-session token for the user receiving the message.
$eventdata->customdata = [
'notificationiconurl' => $userpicture->get_url($PAGE)->out(false),

View File

@ -6335,6 +6335,7 @@ class assign {
// Check if the userfrom is real and visible.
if (!empty($userfrom->id) && core_user::is_real_user($userfrom->id)) {
$userpicture = new user_picture($userfrom);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $userto->id; // Generate an out-of-session token for the user receiving the message.
$customdata['notificationiconurl'] = $userpicture->get_url($PAGE)->out(false);
}

View File

@ -1526,6 +1526,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
$this->assertEquals($assign->get_instance()->id, $customdata->instance);
$this->assertEquals('feedbackavailable', $customdata->messagetype);
$userpicture = new user_picture($teacher);
$userpicture->size = 1; // Use f1 size.
$this->assertEquals($userpicture->get_url($PAGE)->out(false), $customdata->notificationiconurl);
$this->assertEquals(0, $customdata->uniqueidforuser); // Not used in this case.
$this->assertFalse($customdata->blindmarking);

View File

@ -2639,6 +2639,7 @@ function feedback_send_email($cm, $feedback, $course, $user, $completed = null)
$eventdata->contexturlname = $info->feedback;
// User image.
$userpicture = new user_picture($user);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $teacher->id; // Generate an out-of-session token for the user receiving the message.
$customdata['notificationiconurl'] = $userpicture->get_url($PAGE)->out(false);
$eventdata->customdata = $customdata;

View File

@ -353,6 +353,7 @@ class send_user_notifications extends \core\task\adhoc_task {
$eventdata->contexturlname = $discussion->name;
// User image.
$userpicture = new \user_picture($author);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $this->recipient->id; // Generate an out-of-session token for the user receiving the message.
$eventdata->customdata = [
'cmid' => $cm->id,

View File

@ -225,6 +225,7 @@ switch ($mode) {
}
$userpicture = new user_picture($USER);
$userpicture->size = 1; // Use f1 size.
foreach ($attempts as $attempt) {
$essayinfo = lesson_page_type_essay::extract_useranswer($attempt->useranswer);
if ($essayinfo->graded && !$essayinfo->sent) {

View File

@ -1588,6 +1588,7 @@ function quiz_send_notification($recipient, $submitter, $a) {
$eventdata->contexturl = $a->quizreviewurl;
$eventdata->contexturlname = $a->quizname;
$userpicture = new user_picture($submitter);
$userpicture->size = 1; // Use f1 size.
$userpicture->includetoken = $recipient->id; // Generate an out-of-session token for the user receiving the message.
$eventdata->customdata = [
'cmid' => $a->quizcmid,