MDL-76974 javascript: convert remaining uses of old preferences API.

Implement component preference definition callbacks, update JS code
to use the `core_user/repository` module instead of the now deprecated
API.
This commit is contained in:
Paul Holden 2023-06-18 19:11:36 +01:00
parent d096c60e0c
commit b30245b3e2
No known key found for this signature in database
GPG key ID: A81A96D6045F6164
21 changed files with 180 additions and 38 deletions

View file

@ -679,7 +679,6 @@ abstract class user_selector_base {
'" value="1"' . $checked . ' /> ' . $label .
"</label>
</div>\n";
user_preference_allow_ajax_update($name, PARAM_BOOL);
return $output;
}

View file

@ -368,7 +368,9 @@ M.core_user.init_user_selector_options_tracker = function(Y) {
* @param {string} name The name of the preference to set
*/
set_user_preference : function(e, name) {
M.util.set_user_preference(name, Y.one('#' + name + 'id').get('checked'));
require(['core_user/repository'], function(UserRepository) {
UserRepository.setUserPreference(name, Y.one('#' + name + 'id').get('checked'));
});
}
};
// Initialise the options tracker