Merge branch 'MDL-67070-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Jun Pataleta 2020-06-11 14:22:48 +08:00
commit f2dc6313f0
9 changed files with 22 additions and 37 deletions

View File

@ -845,21 +845,19 @@ class manager {
// the format filename => version. The version value needs to
// be increased if the tour has been updated.
$shippedtours = [
'36_dashboard.json' => 3
];
// These are tours that we used to ship but don't ship any longer.
// We do not remove them, but we do disable them.
$unshippedtours = [
// Formerly included in Moodle 3.2.0.
'boost_administrator.json' => 1,
'boost_course_view.json' => 1,
];
if ($CFG->messaging) {
$shippedtours['36_messaging.json'] = 3;
} else {
$unshippedtours['36_messaging.json'] = 3;
}
// Formerly included in Moodle 3.6.0.
'36_dashboard.json' => 3,
'36_messaging.json' => 3,
];
$existingtourrecords = $DB->get_recordset('tool_usertours_tours');

View File

@ -38,34 +38,20 @@ function xmldb_tool_usertours_upgrade($oldversion) {
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2018113002) {
// Update the tours shipped with Moodle.
manager::update_shipped_tours();
upgrade_plugin_savepoint(true, 2018113002, 'tool', 'usertours');
}
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2019030600) {
// Update the tours shipped with Moodle.
manager::update_shipped_tours();
upgrade_plugin_savepoint(true, 2019030600, 'tool', 'usertours');
}
// Automatically generated Moodle v3.7.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.8.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2020031900) {
if ($oldversion < 2020061501) {
// Updating shipped tours will fix broken sortorder records in existing tours.
manager::update_shipped_tours();
upgrade_plugin_savepoint(true, 2020031900, 'tool', 'usertours');
upgrade_plugin_savepoint(true, 2020061501, 'tool', 'usertours');
}
return true;

View File

@ -40,6 +40,15 @@ use \tool_usertours\privacy\provider;
*/
class tool_usertours_privacy_testcase extends \core_privacy\tests\provider_testcase {
protected function create_test_tour(): tour {
return (new tour())
->set_name('test_tour')
->set_description('Test tour')
->set_enabled(true)
->set_pathmatch('/')
->persist();
}
/**
* Ensure that get_metadata exports valid content.
*/
@ -71,11 +80,9 @@ class tool_usertours_privacy_testcase extends \core_privacy\tests\provider_testc
$this->resetAfterTest();
$this->setAdminUser();
$alltours = $DB->get_records('tool_usertours_tours');
$tourdata = reset($alltours);
$tour = $this->create_test_tour();
$user = \core_user::get_user_by_username('admin');
$tour = tour::instance($tourdata->id);
$tour->mark_user_completed();
provider::export_user_preferences($user->id);
@ -96,11 +103,9 @@ class tool_usertours_privacy_testcase extends \core_privacy\tests\provider_testc
$this->resetAfterTest();
$this->setAdminUser();
$alltours = $DB->get_records('tool_usertours_tours');
$tourdata = reset($alltours);
$tour = $this->create_test_tour();
$user = \core_user::get_user_by_username('admin');
$tour = tour::instance($tourdata->id);
$tour->mark_user_completed();
$tour->request_user_reset();
provider::export_user_preferences($user->id);
@ -122,14 +127,15 @@ class tool_usertours_privacy_testcase extends \core_privacy\tests\provider_testc
$this->resetAfterTest();
$this->setAdminUser();
$tour1 = $this->create_test_tour();
$tour2 = $this->create_test_tour();
$user = \core_user::get_user_by_username('admin');
$alltours = $DB->get_records('tool_usertours_tours');
$tour1 = tour::instance(array_shift($alltours)->id);
$tour1->mark_user_completed();
$tour2 = tour::instance(array_shift($alltours)->id);
$tour2->mark_user_completed();
$tour2->remove();

View File

View File

@ -1 +0,0 @@
{"name":"Dashboard","description":"New dashboard features","pathmatch":"\/my\/%","enabled":"1","sortorder":"3","configdata":"{\"placement\":\"top\",\"orphan\":\"0\",\"backdrop\":\"0\",\"reflex\":\"0\",\"filtervalues\":{\"category\":[],\"course\":[\"0\"],\"courseformat\":[],\"role\":[],\"theme\":[]},\"majorupdatetime\":1543396938}","version":"2018051400","steps":[{"title":"tour3_title_dashboard,tool_usertours","content":"tour3_content_dashboard,tool_usertours","targettype":"2","targetvalue":"","sortorder":"0","configdata":"{\"backdrop\":\"1\"}"},{"title":"tour3_title_dashboard,tool_usertours","content":"tour3_content_timeline,tool_usertours","targettype":"1","targetvalue":"timeline","sortorder":"1","configdata":"{\"reflex\":\"0\"}"},{"title":"tour3_title_recentcourses,tool_usertours","content":"tour3_content_recentcourses,tool_usertours","targettype":"1","targetvalue":"recentlyaccessedcourses","sortorder":"2","configdata":"{\"placement\":\"top\",\"backdrop\":\"1\"}"},{"title":"tour3_title_overview,tool_usertours","content":"tour3_content_overview,tool_usertours","targettype":"1","targetvalue":"myoverview","sortorder":"3","configdata":"{}"},{"title":"tour3_title_starring,tool_usertours","content":"tour3_content_starring,tool_usertours","targettype":"0","targetvalue":".block-myoverview [data-display=\"cards\"] [data-region=\"course-content\"] .coursemenubtn","sortorder":"4","configdata":"{\"placement\":\"right\"}"},{"title":"tour3_title_starring,tool_usertours","content":"tour3_content_starring,tool_usertours","targettype":"0","targetvalue":".block-myoverview [data-display]:not([data-display=\"cards\"]) [data-region=\"course-content\"] .coursemenubtn","sortorder":"5","configdata":"{}"},{"title":"tour3_title_displayoptions,tool_usertours","content":"tour3_content_displayoptions,tool_usertours","targettype":"0","targetvalue":"#sortingdropdown","sortorder":"6","configdata":"{\"placement\":\"top\"}"},{"title":"tour_final_step_title,tool_usertours","content":"tour_final_step_content,tool_usertours","targettype":"2","targetvalue":"","sortorder":"7","configdata":"{}"}]}

View File

@ -1 +0,0 @@
{"name":"New Messaging System","description":"New messaging interface in Moodle 3.6","pathmatch":"\/course\/view.php%","enabled":"1","sortorder":"2","configdata":"{\"placement\":\"bottom\",\"orphan\":\"0\",\"backdrop\":\"0\",\"reflex\":\"0\",\"filtervalues\":{\"category\":[],\"course\":[\"0\"],\"courseformat\":[],\"role\":[],\"theme\":[]},\"majorupdatetime\":1543468823}","version":"2018051400","steps":[{"title":"tour4_title_messaging,tool_usertours","content":"tour4_content_messaging,tool_usertours","targettype":"2","targetvalue":"","sortorder":"0","configdata":"{\"backdrop\":\"1\"}"},{"title":"tour4_title_icon,tool_usertours","content":"tour4_content_icon,tool_usertours","targettype":"0","targetvalue":"[id^=message-drawer-toggle]","sortorder":"1","configdata":"{\"backdrop\":\"0\",\"reflex\":\"1\"}"},{"title":"tour4_title_groupconvo,tool_usertours","content":"tour4_content_groupconvo,tool_usertours","targettype":"0","targetvalue":".message-drawer:not(.hidden) [data-region=\"view-overview-group-messages\"]","sortorder":"2","configdata":"{\"placement\":\"left\"}"},{"title":"tour4_title_starred,tool_usertours","content":"tour4_content_starred,tool_usertours","targettype":"0","targetvalue":".message-drawer:not(.hidden) [data-region=\"view-overview-favourites\"]","sortorder":"3","configdata":"{\"placement\":\"left\"}"},{"title":"tour4_title_settings,tool_usertours","content":"tour4_content_settings,tool_usertours","targettype":"0","targetvalue":".message-drawer:not(.hidden) [data-route=\"view-settings\"]","sortorder":"4","configdata":"{\"reflex\":\"1\"}"},{"title":"tour_final_step_title,tool_usertours","content":"tour_final_step_content,tool_usertours","targettype":"2","targetvalue":"","sortorder":"5","configdata":"{}"}]}

View File

@ -1,2 +0,0 @@
{"name":"Boost - administrator","description":"A tour of some new features in the Boost theme, for administrators","pathmatch":"FRONTPAGE","enabled":"1","sortorder":"0","configdata":"{\"placement\":\"bottom\",\"orphan\":\"0\",\"backdrop\":\"1\",\"reflex\":\"0\",\"filtervalues\":{\"role\":[\"-1\"],\"theme\":[\"boost\"]},\"majorupdatetime\":1479366244,\"default_tour\":true,\"filename\":\"boost_administrator.json\",\"version\":1}","version":"2016102001","steps":[{"title":"tour1_title_welcome,tool_usertours","content":"tour1_content_welcome,tool_usertours","targettype":"2","targetvalue":"","sortorder":"0","configdata":"{}"},{"title":"tour1_title_navigation,tool_usertours","content":"tour1_content_navigation,tool_usertours","targettype":"0","targetvalue":"[data-region=\"drawer-toggle\"] button[data-action=\"toggle-drawer\"]","sortorder":"1","configdata":"{}"},{"title":"tour1_title_customisation,tool_usertours","content":"tour1_content_customisation,tool_usertours","targettype":"0","targetvalue":"body:not(.editing) #page-header .card-block","sortorder":"2","configdata":"{\"placement\":\"bottom\"}"},{"title":"tour1_title_blockregion,tool_usertours","content":"tour1_content_blockregion,tool_usertours","targettype":"0","targetvalue":"body.editing [data-region=\"blocks-column\"]","sortorder":"3","configdata":"{}"},{"title":"tour1_title_addingblocks,tool_usertours","content":"tour1_content_addingblocks,tool_usertours","targettype":"0","targetvalue":"body.editing [data-region=\"blocks-column\"]","sortorder":"4","configdata":"{\"placement\":\"bottom\"}"},{"title":"tour1_title_end,tool_usertours","content":"tour1_content_end,tool_usertours","targettype":"2","targetvalue":"","sortorder":"5","configdata":"{}"}]}

View File

@ -1 +0,0 @@
{"name":"Boost - course view","description":"A tour for introducing administrators and teachers to courses in the Boost theme","pathmatch":"\/course\/view.php%","enabled":"1","sortorder":"1","configdata":"{\"placement\":\"bottom\",\"orphan\":\"0\",\"backdrop\":\"1\",\"reflex\":\"0\",\"filtervalues\":{\"role\":[\"-1\",\"editingteacher\"],\"theme\":[\"boost\"]},\"majorupdatetime\":1480050104,\"shipped_tour\":true,\"shipped_filename\":\"boost_course_view.json\",\"shipped_version\":1}","version":"2016120501","steps":[{"title":"tour2_title_welcome,tool_usertours","content":"tour2_content_welcome,tool_usertours","targettype":"2","targetvalue":"","sortorder":"0","configdata":"{}"},{"title":"tour2_title_customisation,tool_usertours","content":"tour2_content_customisation,tool_usertours","targettype":"0","targetvalue":"body:not(.editing) #page-header .card-block","sortorder":"1","configdata":"{}"},{"title":"tour2_title_navigation,tool_usertours","content":"tour2_content_navigation,tool_usertours","targettype":"0","targetvalue":"[data-region=\"drawer-toggle\"] button[data-action=\"toggle-drawer\"]","sortorder":"2","configdata":"{}"},{"title":"tour2_title_opendrawer,tool_usertours","content":"tour2_content_opendrawer,tool_usertours","targettype":"0","targetvalue":"body:not(.drawer-open-left) [data-region=\"drawer-toggle\"] button[data-action=\"toggle-drawer\"]","sortorder":"3","configdata":"{}"},{"title":"tour2_title_participants,tool_usertours","content":"tour2_content_participants,tool_usertours","targettype":"0","targetvalue":"body.drawer-open-left [data-region=\"drawer\"] [data-key=\"participants\"]","sortorder":"4","configdata":"{\"placement\":\"bottom\",\"backdrop\":\"0\"}"},{"title":"tour2_title_addblock,tool_usertours","content":"tour2_content_addblock,tool_usertours","targettype":"0","targetvalue":"body.drawer-open-left:not(.editing) [data-region=\"drawer\"]","sortorder":"5","configdata":"{\"placement\":\"right\",\"orphan\":\"0\",\"backdrop\":\"0\",\"reflex\":\"0\"}"},{"title":"tour2_title_addingblocks,tool_usertours","content":"tour2_content_addingblocks,tool_usertours","targettype":"0","targetvalue":"body.drawer-open-left.editing [data-region=\"drawer\"] [data-key=\"addblock\"]","sortorder":"6","configdata":"{\"backdrop\":\"0\",\"placement\":\"top\"}"},{"title":"tour2_title_end,tool_usertours","content":"tour2_content_end,tool_usertours","targettype":"2","targetvalue":"","sortorder":"7","configdata":"{}"}]}

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2020061501; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020060900; // Requires this Moodle version.
$plugin->component = 'tool_usertours'; // Full name of the plugin (used for diagnostics).