Merge branch 'develop' into v4

This commit is contained in:
Salvatore Giordano
2022-04-04 12:09:21 +02:00
2 changed files with 11 additions and 6 deletions
+2
View File
@@ -17,6 +17,8 @@
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`.
- [[#1033]](https://github.com/GetStream/stream-chat-flutter/issues/1033) Hard delete from dashboard does not delete message from client.
✅ Added
@@ -1116,7 +1116,6 @@ class Channel {
// remove the passed message if response does
// not contain message
state!.removeMessage(message);
await _client.chatPersistenceClient?.deleteMessageById(messageId);
}
return res;
}
@@ -1608,10 +1607,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),
));
}));
}
@@ -1871,7 +1872,9 @@ class ChannelClientState {
}
/// Remove a [message] from this [channelState].
void removeMessage(Message message) {
void removeMessage(Message message) async {
await _channel._client.chatPersistenceClient?.deleteMessageById(message.id);
final parentId = message.parentId;
// i.e. it's a thread message, Remove it
if (parentId != null) {