MDL-65572 messaging: Loginas upgrade check
When using login as, we also need to check if there are legacy messages that need updating and set the user preference if required.
This commit is contained in:
@@ -933,6 +933,16 @@ class manager {
|
||||
if ($generateevent) {
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
// Queue migrating the messaging data, if we need to.
|
||||
if (!get_user_preferences('core_message_migrate_data', false, $userid)) {
|
||||
// Check if there are any legacy messages to migrate.
|
||||
if (\core_message\helper::legacy_messages_exist($userid)) {
|
||||
\core_message\task\migrate_message_data::queue_task($userid);
|
||||
} else {
|
||||
set_user_preference('core_message_migrate_data', true, $userid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user