When enabling the bot, the Language level of the bot should default to that of the class
This commit is contained in:
parent
5ad48def7c
commit
8c108f6708
2 changed files with 10 additions and 0 deletions
|
|
@ -86,6 +86,7 @@ class NewGroupView extends StatelessWidget {
|
|||
// ),
|
||||
ConversationBotSettings(
|
||||
key: controller.addConversationBotKey,
|
||||
activeSpaceId: controller.activeSpaceId,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
AddToSpaceToggles(
|
||||
|
|
|
|||
|
|
@ -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<ConversationBotSettings> {
|
|||
late BotOptionsModel botOptions;
|
||||
late bool isOpen;
|
||||
bool addBot = false;
|
||||
Room? parentSpace;
|
||||
|
||||
ConversationBotSettingsState({Key? key});
|
||||
|
||||
|
|
@ -50,6 +53,12 @@ class ConversationBotSettingsState extends State<ConversationBotSettings> {
|
|||
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<void> updateBotOption(void Function() makeLocalChange) async {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue