refactor: Reinvite other part instead of reopen dm

This commit is contained in:
Krille 2023-12-22 12:45:49 +01:00
parent e2a251b3fe
commit 26c637135a
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652

View file

@ -201,20 +201,10 @@ class ChatController extends State<ChatPageWithRoom> {
'Try to recreate a room with is not a DM room. This should not be possible from the UI!',
);
}
final success = await showFutureLoadingDialog(
await showFutureLoadingDialog(
context: context,
future: () async {
final client = room.client;
final waitForSync = client.onSync.stream
.firstWhere((s) => s.rooms?.leave?.containsKey(room.id) ?? false);
await room.leave();
await waitForSync;
return await client.startDirectChat(userId);
},
future: () => room.invite(userId),
);
final roomId = success.result;
if (roomId == null) return;
context.go('/rooms/$roomId');
}
void leaveChat() async {