From 2fbc4e2016496e7db9fee05c9d1a5c9877ee652b Mon Sep 17 00:00:00 2001 From: Kelrap Date: Tue, 16 Jul 2024 13:59:45 -0400 Subject: [PATCH 1/2] Doesn't add welcome chat to subspace --- lib/pages/login/login_view.dart | 2 +- lib/pages/new_space/new_space.dart | 32 ++++++++++++++++++------------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/pages/login/login_view.dart b/lib/pages/login/login_view.dart index a50567eea..818dd06b4 100644 --- a/lib/pages/login/login_view.dart +++ b/lib/pages/login/login_view.dart @@ -147,7 +147,7 @@ class LoginView extends StatelessWidget { controller.showPassword ? Icons.visibility_off_outlined : Icons.visibility_outlined, - color: Colors.black, + // color: Colors.black, ), ), ), diff --git a/lib/pages/new_space/new_space.dart b/lib/pages/new_space/new_space.dart index 1903a6200..d5e41410d 100644 --- a/lib/pages/new_space/new_space.dart +++ b/lib/pages/new_space/new_space.dart @@ -198,14 +198,18 @@ class NewSpaceController extends State { if (capacity != null && space != null) { space.updateRoomCapacity(capacity); } - final newChatRoomId = await Matrix.of(context).client.createGroupChat( - enableEncryption: false, - preset: sdk.CreateRoomPreset.publicChat, - // Welcome chat name is '[space name acronym]: Welcome Chat' - groupName: - '${nameController.text.trim().split(RegExp(r"\s+")).map((s) => s[0]).join()}: ${L10n.of(context)!.classWelcomeChat}', - ); - GoogleAnalytics.createChat(newChatRoomId); + // If space has no parents, add welcome chat + String? newChatRoomId; + if (space?.pangeaSpaceParents.isEmpty ?? false) { + newChatRoomId = await Matrix.of(context).client.createGroupChat( + enableEncryption: false, + preset: sdk.CreateRoomPreset.publicChat, + // Welcome chat name is '[space name acronym]: Welcome Chat' + groupName: + '${nameController.text.trim().split(RegExp(r"\s+")).map((s) => s[0]).join()}: ${L10n.of(context)!.classWelcomeChat}', + ); + GoogleAnalytics.createChat(newChatRoomId); + } final Room? room = Matrix.of(context).client.getRoomById(spaceId); if (room == null) { @@ -217,11 +221,13 @@ class NewSpaceController extends State { return; } - room.setSpaceChild(newChatRoomId, suggested: true); - GoogleAnalytics.addParent( - newChatRoomId, - room.classCode, - ); + if (newChatRoomId != null) { + room.setSpaceChild(newChatRoomId, suggested: true); + GoogleAnalytics.addParent( + newChatRoomId, + room.classCode, + ); + } GoogleAnalytics.createClass(room.name, room.classCode); try { From 5a06e708020671945d60bafb626abd9ee35fc32d Mon Sep 17 00:00:00 2001 From: Kelrap Date: Tue, 16 Jul 2024 14:36:15 -0400 Subject: [PATCH 2/2] Do not create welcome chats under any circumstance --- lib/pages/new_space/new_space.dart | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/lib/pages/new_space/new_space.dart b/lib/pages/new_space/new_space.dart index d5e41410d..57462a698 100644 --- a/lib/pages/new_space/new_space.dart +++ b/lib/pages/new_space/new_space.dart @@ -198,18 +198,6 @@ class NewSpaceController extends State { if (capacity != null && space != null) { space.updateRoomCapacity(capacity); } - // If space has no parents, add welcome chat - String? newChatRoomId; - if (space?.pangeaSpaceParents.isEmpty ?? false) { - newChatRoomId = await Matrix.of(context).client.createGroupChat( - enableEncryption: false, - preset: sdk.CreateRoomPreset.publicChat, - // Welcome chat name is '[space name acronym]: Welcome Chat' - groupName: - '${nameController.text.trim().split(RegExp(r"\s+")).map((s) => s[0]).join()}: ${L10n.of(context)!.classWelcomeChat}', - ); - GoogleAnalytics.createChat(newChatRoomId); - } final Room? room = Matrix.of(context).client.getRoomById(spaceId); if (room == null) { @@ -221,14 +209,6 @@ class NewSpaceController extends State { return; } - if (newChatRoomId != null) { - room.setSpaceChild(newChatRoomId, suggested: true); - GoogleAnalytics.addParent( - newChatRoomId, - room.classCode, - ); - } - GoogleAnalytics.createClass(room.name, room.classCode); try { await room.invite(BotName.byEnvironment);