Merge pull request #1055 from GetStream/hotfix/memberRemoved

fix(llc): member removed
This commit is contained in:
Salvatore Giordano
2022-04-04 11:03:04 +02:00
committed by GitHub
2 changed files with 7 additions and 4 deletions
+1
View File
@@ -7,6 +7,7 @@
any channel.
- [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` extraData missing after
channel update.
- [[#1054]](https://github.com/GetStream/stream-chat-flutter/issues/1054) Fix `Unsupported operation: Cannot remove from an unmodifiable list`.
✅ Added
@@ -1586,10 +1586,12 @@ class ChannelClientState {
_subscriptions.add(_channel.on(EventType.memberRemoved).listen((Event e) {
final user = e.user;
updateChannelState(channelState.copyWith(
members: List.from(
channelState.members..removeWhere((m) => m.userId == user!.id),
),
read: channelState.read..removeWhere((r) => r.user.id == user!.id),
members: channelState.members
.where((m) => m.userId != user!.id)
.toList(growable: false),
read: channelState.read
.where((r) => r.user.id != user!.id)
.toList(growable: false),
));
}));
}