Merge branch 'krille/fix-start-chat' into 'main'

fix: Dont enable e2ee without encryption support

See merge request famedly/company/frontend/famedlysdk!893
This commit is contained in:
Nicolas Werner 2021-11-16 08:07:32 +00:00
commit ae5225f495
1 changed files with 4 additions and 1 deletions

View File

@ -568,7 +568,8 @@ class Client extends MatrixApi {
final directChatRoomId = getDirectChatFromUserId(mxid);
if (directChatRoomId != null) return directChatRoomId;
enableEncryption ??= await userOwnsEncryptionKeys(mxid);
enableEncryption ??=
encryptionEnabled && await userOwnsEncryptionKeys(mxid);
if (enableEncryption) {
initialState ??= [];
if (!initialState.any((s) => s.type == EventTypes.Encryption)) {
@ -609,6 +610,7 @@ class Client extends MatrixApi {
List<String>? invite,
CreateRoomPreset preset = CreateRoomPreset.privateChat,
List<StateEvent>? initialState,
Visibility? visibility,
bool waitForSync = true,
}) async {
enableEncryption ??=
@ -629,6 +631,7 @@ class Client extends MatrixApi {
preset: preset,
name: groupName,
initialState: initialState,
visibility: visibility,
);
if (waitForSync) {