From 8c108f670864901c808c7d398468f83e87ca3490 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Wed, 8 May 2024 15:36:11 -0400 Subject: [PATCH] When enabling the bot, the Language level of the bot should default to that of the class --- lib/pages/new_group/new_group_view.dart | 1 + .../conversation_bot/conversation_bot_settings.dart | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/pages/new_group/new_group_view.dart b/lib/pages/new_group/new_group_view.dart index eb0fa605d..822b89214 100644 --- a/lib/pages/new_group/new_group_view.dart +++ b/lib/pages/new_group/new_group_view.dart @@ -86,6 +86,7 @@ class NewGroupView extends StatelessWidget { // ), ConversationBotSettings( key: controller.addConversationBotKey, + activeSpaceId: controller.activeSpaceId, ), const Divider(height: 1), AddToSpaceToggles( diff --git a/lib/pangea/widgets/conversation_bot/conversation_bot_settings.dart b/lib/pangea/widgets/conversation_bot/conversation_bot_settings.dart index 94214c8d2..0227c243a 100644 --- a/lib/pangea/widgets/conversation_bot/conversation_bot_settings.dart +++ b/lib/pangea/widgets/conversation_bot/conversation_bot_settings.dart @@ -20,12 +20,14 @@ import '../../utils/error_handler.dart'; class ConversationBotSettings extends StatefulWidget { final Room? room; final bool startOpen; + final String? activeSpaceId; // final ClassSettingsModel? initialSettings; const ConversationBotSettings({ super.key, this.room, this.startOpen = false, + this.activeSpaceId, // this.initialSettings, }); @@ -37,6 +39,7 @@ class ConversationBotSettingsState extends State { late BotOptionsModel botOptions; late bool isOpen; bool addBot = false; + Room? parentSpace; ConversationBotSettingsState({Key? key}); @@ -50,6 +53,12 @@ class ConversationBotSettingsState extends State { addBot = isBotRoom; }); }); + parentSpace = widget.activeSpaceId != null + ? Matrix.of(context).client.getRoomById(widget.activeSpaceId!) + : null; + if (parentSpace != null && botOptions.languageLevel == null) { + botOptions.languageLevel = parentSpace?.classSettings?.languageLevel; + } } Future updateBotOption(void Function() makeLocalChange) async {