[DevicekeysList] Clear outbound group session on blocking device

This commit is contained in:
Christian Pauly 2020-02-19 10:54:08 +01:00
parent 67ac01fdc5
commit 5d73f06cd3

View file

@ -1,6 +1,7 @@
import 'dart:convert';
import '../client.dart';
import '../room.dart';
class DeviceKeysList {
String userId;
@ -55,6 +56,12 @@ class DeviceKeys {
Future<void> setBlocked(bool newBlocked, Client client) {
blocked = newBlocked;
for (Room room in client.rooms) {
if (!room.encrypted) continue;
if (room.getParticipants().indexWhere((u) => u.id == userId) != -1) {
room.clearOutboundGroupSession();
}
}
return client.storeAPI.storeUserDeviceKeys(client.userDeviceKeys);
}