mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-60680 notifications: Include action buttons information
This commit is contained in:
parent
36fa0ec900
commit
2356454f21
12 changed files with 77 additions and 27 deletions
|
@ -1521,7 +1521,7 @@ class mod_assign_locallib_testcase extends advanced_testcase {
|
|||
$this->assertEquals(1, $messages[0]->notification);
|
||||
$this->assertEquals($assign->get_instance()->name, $messages[0]->contexturlname);
|
||||
// Test customdata.
|
||||
$customdata = json_decode($messages[0]->customdata);
|
||||
$customdata = json_decode($messages[0]->customdata);
|
||||
$this->assertEquals($assign->get_course_module()->id, $customdata->cmid);
|
||||
$this->assertEquals($assign->get_instance()->id, $customdata->instance);
|
||||
$this->assertEquals('feedbackavailable', $customdata->messagetype);
|
||||
|
|
|
@ -519,7 +519,7 @@ class mod_feedback_external_testcase extends externallib_advanced_testcase {
|
|||
$this->assertCount(7, $tmpitems); // 2 from the first page + 5 from the second page.
|
||||
|
||||
// And finally, save everything! We are going to modify one previous recorded value.
|
||||
$messagesSink = $this->redirectMessages();
|
||||
$messagessink = $this->redirectMessages();
|
||||
$data[2]['value'] = 2; // 2 is value of the option 'b'.
|
||||
$secondpagedata = [$data[2], $data[3], $data[4], $data[5], $data[6]];
|
||||
$result = mod_feedback_external::process_page($this->feedback->id, 1, $secondpagedata);
|
||||
|
@ -544,10 +544,10 @@ class mod_feedback_external_testcase extends externallib_advanced_testcase {
|
|||
$this->assertEquals(0, $completed->courseid);
|
||||
|
||||
// Test notifications sent.
|
||||
$messages = $messagesSink->get_messages();
|
||||
$messagesSink->close();
|
||||
$messages = $messagessink->get_messages();
|
||||
$messagessink->close();
|
||||
// Test customdata.
|
||||
$customdata = json_decode($messages[0]->customdata);
|
||||
$customdata = json_decode($messages[0]->customdata);
|
||||
$this->assertEquals($this->feedback->id, $customdata->instance);
|
||||
$this->assertEquals($this->feedback->cmid, $customdata->cmid);
|
||||
$this->assertObjectHasAttribute('notificationiconurl', $customdata);
|
||||
|
|
|
@ -360,6 +360,9 @@ class send_user_notifications extends \core\task\adhoc_task {
|
|||
'discussionid' => $discussion->id,
|
||||
'postid' => $post->id,
|
||||
'notificationiconurl' => $userpicture->get_url($PAGE)->out(false),
|
||||
'actionbuttons' => [
|
||||
'reply' => get_string_manager()->get_string('reply', 'forum', null, $eventdata->userto->lang),
|
||||
],
|
||||
];
|
||||
|
||||
return message_send($eventdata);
|
||||
|
|
|
@ -1530,11 +1530,13 @@ class mod_forum_mail_testcase extends advanced_testcase {
|
|||
$this->send_notifications_and_assert($author, [$post]);
|
||||
$this->send_notifications_and_assert($commenter, [$post]);
|
||||
$messages = $this->messagesink->get_messages();
|
||||
$customdata = json_decode($messages[0]->customdata);
|
||||
$customdata = json_decode($messages[0]->customdata);
|
||||
$this->assertEquals($forum->id, $customdata->instance);
|
||||
$this->assertEquals($forum->cmid, $customdata->cmid);
|
||||
$this->assertEquals($post->id, $customdata->postid);
|
||||
$this->assertEquals($discussion->id, $customdata->discussionid);
|
||||
$this->assertObjectHasAttribute('notificationiconurl', $customdata);
|
||||
$this->assertObjectHasAttribute('actionbuttons', $customdata);
|
||||
$this->assertCount(1, (array) $customdata->actionbuttons);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1193,6 +1193,7 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase {
|
|||
$result = external_api::clean_returnvalue(mod_quiz_external::process_attempt_returns(), $result);
|
||||
$this->assertEquals(quiz_attempt::FINISHED, $result['state']);
|
||||
$messages = $sink->get_messages();
|
||||
$message = reset($messages);
|
||||
$sink->close();
|
||||
// Test customdata.
|
||||
if (!empty($message->customdata)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue