Skip to content

Commit

Permalink
Merge tag 'v4.1.5' into UCSFCLE_401_STABLE
Browse files Browse the repository at this point in the history
MOODLE_4015
  • Loading branch information
ctam committed Aug 28, 2023
2 parents e954b62 + b156b18 commit 59f6337
Show file tree
Hide file tree
Showing 114 changed files with 1,123 additions and 682 deletions.
38 changes: 11 additions & 27 deletions admin/tool/dataprivacy/tests/behat/protecteddelete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Feature: Protected data should not be deleted
| Site purpose | PT1H | 0 |
| prot | P1D | 1 |
| unprot | P1D | 0 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| u1 | forump1 | Discussion subject | Test post in forump1 |
| u1 | forumu1 | Discussion subject | Test post in forumu1 |
| u1 | forump2 | Discussion subject | Test post in forump2 |
| u1 | forumu2 | Discussion subject | Test post in forumu2 |
And I set the category and purpose for the "forump1" "forum" in course "C1" to "CAT" and "prot"
And I set the category and purpose for the "forump2" "forum" in course "C2" to "CAT" and "prot"
And I set the category and purpose for the "forumu1" "forum" in course "C1" to "CAT" and "unprot"
Expand All @@ -38,47 +44,25 @@ Feature: Protected data should not be deleted

@javascripta
Scenario: Unexpired and protected data is not removed
Given I log in as "u1"
And I am on "C1" course homepage
And I add a new discussion to "forump1" forum with:
| Subject | Discussion subject |
| Message | Test post in forump1 |
And I am on "C1" course homepage
And I add a new discussion to "forumu1" forum with:
| Subject | Discussion subject |
| Message | Test post in forumu1 |
And I am on "C2" course homepage
And I add a new discussion to "forump2" forum with:
| Subject | Discussion subject |
| Message | Test post in forump2 |
And I am on "C2" course homepage
And I add a new discussion to "forumu2" forum with:
| Subject | Discussion subject |
| Message | Test post in forumu2 |
And I log out
And I log in as "admin"
Given I log in as "admin"
And I create a dataprivacy "delete" request for "u1"
And I approve a dataprivacy "delete" request for "u1"
And I run all adhoc tasks
And I navigate to "Users > Privacy and policies > Data requests" in site administration
And I should see "Deleted" in the "u1" "table_row"

And I am on "C1" course homepage
And I follow "forump1"
And I am on the "forump1" "forum activity" page
And I follow "Discussion subject"
Then I should not see "Test post in forump1"

When I am on "C1" course homepage
And I follow "forumu1"
When I am on the "forumu1" "forum activity" page
And I follow "Discussion subject"
Then I should not see "Test post in forumu1"

And I am on "C2" course homepage
And I follow "forump2"
And I am on the "forump2" "forum activity" page
And I follow "Discussion subject"
Then I should see "Test post in forump2"

When I am on "C2" course homepage
And I follow "forumu2"
When I am on the "forumu2" "forum activity" page
And I follow "Discussion subject"
Then I should not see "Test post in forumu2"
2 changes: 2 additions & 0 deletions admin/tool/lpimportcsv/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');

admin_externalpage_setup('toollpexportcsv');

$pagetitle = get_string('exportnavlink', 'tool_lpimportcsv');

$context = context_system::instance();
Expand Down
2 changes: 2 additions & 0 deletions admin/tool/lpimportcsv/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');

admin_externalpage_setup('toollpimportcsv');

$pagetitle = get_string('pluginname', 'tool_lpimportcsv');

$context = context_system::instance();
Expand Down
3 changes: 1 addition & 2 deletions admin/tool/monitor/classes/subscription_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,9 @@ public static function remove_all_subscriptions_for_rule($ruleid, $coursecontext
if (!is_null($coursecontext)) {
$context = $coursecontext;
$courseid = $subscription->courseid;
} else if (!empty($subscription->courseid) && ($coursecontext =
} else if (!empty($subscription->courseid) && ($context =
\context_course::instance($subscription->courseid, IGNORE_MISSING))) {
$courseid = $subscription->courseid;
$context = $coursecontext;
} else {
$courseid = 0;
$context = \context_system::instance();
Expand Down
9 changes: 6 additions & 3 deletions admin/tool/policy/classes/output/page_viewalldoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@
*/
class page_viewalldoc implements renderable, templatable {

/** @var string Return url */
private $returnurl;
/** @var ?moodle_url Return url */
private $returnurl = null;

/**
* Prepare the page for rendering.
*
*/
public function __construct($returnurl) {
$this->returnurl = $returnurl;
if (!empty($returnurl)) {
$this->returnurl = new moodle_url($returnurl);
}

$this->prepare_global_page_access();
$this->prepare_policies();
}
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploadcourse/classes/course.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class tool_uploadcourse_course {
/** @var array fields allowed as course data. */
static protected $validfields = array('fullname', 'shortname', 'idnumber', 'category', 'visible', 'startdate', 'enddate',
'summary', 'format', 'theme', 'lang', 'newsitems', 'showgrades', 'showreports', 'legacyfiles', 'maxbytes',
'groupmode', 'groupmodeforce', 'enablecompletion', 'downloadcontent');
'groupmode', 'groupmodeforce', 'enablecompletion', 'downloadcontent', 'showactivitydates');

/** @var array fields required on course creation. */
static protected $mandatoryfields = array('fullname', 'category');
Expand Down
4 changes: 4 additions & 0 deletions admin/tool/uploadcourse/classes/step2_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public function definition () {
$mform->addHelpButton('defaults[enablecompletion]', 'enablecompletion', 'completion');
}

$mform->addElement('selectyesno', 'defaults[showactivitydates]', get_string('showactivitydates'));
$mform->addHelpButton('defaults[showactivitydates]', 'showactivitydates');
$mform->setDefault('defaults[showactivitydates]', $courseconfig->showactivitydates);

// Add custom fields to the form.
$handler = \core_course\customfield\course_handler::create();
$handler->instance_form_definition($mform, 0, 'defaultvaluescustomfieldcategory', 'tool_uploadcourse');
Expand Down
1 change: 1 addition & 0 deletions admin/tool/uploadcourse/cli/uploadcourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
$defaults['visible'] = $courseconfig->visible;
$defaults['lang'] = $courseconfig->lang;
$defaults['enablecompletion'] = $courseconfig->enablecompletion;
$defaults['showactivitydates'] = $courseconfig->showactivitydates;

// Course template.
if (isset($options['templatecourse'])) {
Expand Down
8 changes: 8 additions & 0 deletions admin/tool/uploadcourse/tests/course_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ public function test_data_saved() {
'groupmode' => '2',
'groupmodeforce' => '1',
'enablecompletion' => '1',
'showactivitydates' => '1',
'tags' => 'Cat, Dog',

'role_teacher' => 'Knight',
Expand Down Expand Up @@ -478,6 +479,7 @@ public function test_data_saved() {
$this->assertEquals($data['groupmode'], $course->groupmode);
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
$this->assertEquals($data['showactivitydates'], $course->showactivitydates);
$this->assertEquals($data['tags'], join(', ', \core_tag_tag::get_item_tags_array('core', 'course', $course->id)));

// Roles.
Expand Down Expand Up @@ -530,6 +532,7 @@ public function test_data_saved() {
'groupmode' => '1',
'groupmodeforce' => '0',
'enablecompletion' => '0',
'showactivitydates' => '0',

'role_teacher' => 'Teacher',
'role_manager' => 'Manager',
Expand Down Expand Up @@ -583,6 +586,7 @@ public function test_data_saved() {
$this->assertEquals($data['groupmode'], $course->groupmode);
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
$this->assertEquals($data['showactivitydates'], $course->showactivitydates);

// Roles.
$roleids = array();
Expand Down Expand Up @@ -644,6 +648,7 @@ public function test_default_data_saved() {
'groupmode' => '2',
'groupmodeforce' => '1',
'enablecompletion' => '1',
'showactivitydates' => '1',
);

$this->assertFalse($DB->record_exists('course', array('shortname' => 'c1')));
Expand Down Expand Up @@ -673,6 +678,7 @@ public function test_default_data_saved() {
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
$this->assertEquals($defaultdata['showactivitydates'], $course->showactivitydates);

// Update.
$cat = $this->getDataGenerator()->create_category();
Expand Down Expand Up @@ -701,6 +707,7 @@ public function test_default_data_saved() {
'groupmode' => '1',
'groupmodeforce' => '0',
'enablecompletion' => '0',
'showactivitydates' => '0',
);

$this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
Expand Down Expand Up @@ -730,6 +737,7 @@ public function test_default_data_saved() {
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
$this->assertEquals($defaultdata['showactivitydates'], $course->showactivitydates);
}

public function test_rename() {
Expand Down
22 changes: 14 additions & 8 deletions auth/oauth2/confirm-linkedlogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@
throw new \moodle_exception('cannotfinduser', '', '', $userid);
}

if (!$user->suspended) {
complete_user_login($user);

\core\session\manager::apply_concurrent_login_limit($user->id, session_id());

if ($user->id == $USER->id) {
// Check where to go, $redirect has a higher preference.
if (empty($redirect) and !empty($SESSION->wantsurl) ) {
$redirect = $SESSION->wantsurl;
Expand All @@ -69,14 +65,24 @@
$PAGE->set_heading($COURSE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
echo "<p>".get_string("confirmed")."</p>\n";
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
// If $wantsurl and $redirect are empty, then the button will navigate the identical user to the dashboard.
if ($user->id == $USER->id) {
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
} else if (!isloggedin() || isguestuser()) {
echo $OUTPUT->single_button(get_login_url(), get_string('login'));
} else {
echo $OUTPUT->single_button("$CFG->wwwroot/login/logout.php", get_string('logout'));
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
} else {
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
// Avoid error if logged-in user visiting the page.
if (!isloggedin()) {
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
}
}

redirect("$CFG->wwwroot/");
6 changes: 6 additions & 0 deletions calendar/classes/local/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ public static function update_event_start_day(
'core_calendar_event_timestart_updated',
[$legacyevent, $moduleinstance]
);

// Rebuild the course cache to make sure the updated dates are reflected.
$courseid = $event->get_course()->get('id');
$cmid = $event->get_course_module()->get('id');
\course_modinfo::purge_course_module_cache($courseid, $cmid);
rebuild_course_cache($courseid, true, true);
}

return $mapper->from_legacy_event_to_event($legacyevent);
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"behat/mink": "^1.10.0",
"friends-of-behat/mink-extension": "^2.7.2",
"behat/mink-goutte-driver": "^2.0",
"symfony/process": "^4.4 || ^5.0",
"behat/behat": "3.12.*",
"oleg-andreyev/mink-phpwebdriver": "^1.2.1"
"symfony/process": "^4.4 || ^5.0 || ^6.0",
"behat/behat": "3.13.*",
"oleg-andreyev/mink-phpwebdriver": "1.2.*"
},
"autoload-dev": {
"psr-0": {
Expand Down
Loading

0 comments on commit 59f6337

Please sign in to comment.