fix: Messages being encrypted for too many devices
This commit is contained in:
parent
ae79af6ea8
commit
74bd1d331b
|
@ -1579,13 +1579,13 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
/// you can safely make this Client instance null.
|
/// you can safely make this Client instance null.
|
||||||
Future<void> dispose({bool closeDatabase = false}) async {
|
Future<void> dispose({bool closeDatabase = false}) async {
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
encryption?.dispose();
|
|
||||||
encryption = null;
|
|
||||||
try {
|
try {
|
||||||
await _currentTransaction;
|
await _currentTransaction;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// No-OP
|
// No-OP
|
||||||
}
|
}
|
||||||
|
encryption?.dispose();
|
||||||
|
encryption = null;
|
||||||
try {
|
try {
|
||||||
if (closeDatabase) await database?.close();
|
if (closeDatabase) await database?.close();
|
||||||
} catch (error, stacktrace) {
|
} catch (error, stacktrace) {
|
||||||
|
|
|
@ -1620,7 +1620,8 @@ class Room {
|
||||||
var deviceKeys = <DeviceKeys>[];
|
var deviceKeys = <DeviceKeys>[];
|
||||||
var users = await requestParticipants();
|
var users = await requestParticipants();
|
||||||
for (final user in users) {
|
for (final user in users) {
|
||||||
if (client.userDeviceKeys.containsKey(user.id)) {
|
if ([Membership.invite, Membership.join].contains(user.membership) &&
|
||||||
|
client.userDeviceKeys.containsKey(user.id)) {
|
||||||
for (var deviceKeyEntry
|
for (var deviceKeyEntry
|
||||||
in client.userDeviceKeys[user.id].deviceKeys.values) {
|
in client.userDeviceKeys[user.id].deviceKeys.values) {
|
||||||
deviceKeys.add(deviceKeyEntry);
|
deviceKeys.add(deviceKeyEntry);
|
||||||
|
|
|
@ -133,7 +133,7 @@ void main() {
|
||||||
expect(user1.canChangePowerLevel, false);
|
expect(user1.canChangePowerLevel, false);
|
||||||
});
|
});
|
||||||
test('dispose client', () async {
|
test('dispose client', () async {
|
||||||
await client.dispose();
|
await client.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue