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. any channel.
- [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` extraData missing after - [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` extraData missing after
channel update. channel update.
- [[#1054]](https://github.com/GetStream/stream-chat-flutter/issues/1054) Fix `Unsupported operation: Cannot remove from an unmodifiable list`.
✅ Added ✅ Added
@@ -1586,10 +1586,12 @@ class ChannelClientState {
_subscriptions.add(_channel.on(EventType.memberRemoved).listen((Event e) { _subscriptions.add(_channel.on(EventType.memberRemoved).listen((Event e) {
final user = e.user; final user = e.user;
updateChannelState(channelState.copyWith( updateChannelState(channelState.copyWith(
members: List.from( members: channelState.members
channelState.members..removeWhere((m) => m.userId == user!.id), .where((m) => m.userId != user!.id)
), .toList(growable: false),
read: channelState.read..removeWhere((r) => r.user.id == user!.id), read: channelState.read
.where((r) => r.user.id != user!.id)
.toList(growable: false),
)); ));
})); }));
} }