chore: Leave invites and DM rooms when blocking a user

pull/2219/head
Christian Kußowski 4 weeks ago
parent 21a1ceb19e
commit 1ea8664c48
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652

@ -43,9 +43,25 @@ class SettingsIgnoreListController extends State<SettingsIgnoreList> {
errorText = null;
});
final client = Matrix.of(context).client;
showFutureLoadingDialog(
context: context,
future: () => Matrix.of(context).client.ignoreUser(userId),
future: () async {
for (final room in client.rooms) {
final isInviteFromUser = room.membership == Membership.invite &&
room.getState(EventTypes.RoomMember, client.userID!)?.senderId ==
userId;
if (room.directChatMatrixID == userId || isInviteFromUser) {
try {
await room.leave();
} catch (e, s) {
Logs().w('Unable to leave room with blocked user $userId', e, s);
}
}
}
await client.ignoreUser(userId);
},
);
setState(() {});
controller.clear();

Loading…
Cancel
Save