fix(llc): remove deleted reaction in case of reaction.delete event

This commit is contained in:
Salvatore Giordano
2022-01-28 15:17:03 +01:00
parent 48a207c8a7
commit 8861b1d424
@@ -1615,8 +1615,17 @@ class ChannelClientState {
_subscriptions.add(_channel.on(EventType.reactionDeleted).listen((event) {
final oldMessage =
messages.firstWhereOrNull((it) => it.id == event.message?.id);
final reaction = event.reaction;
final ownReactions = oldMessage?.ownReactions
?.whereNot((it) =>
it.type == reaction?.type &&
it.score == reaction?.score &&
it.messageId == reaction?.messageId &&
it.userId == reaction?.userId &&
it.extraData == reaction?.extraData)
.toList(growable: false);
final message = event.message!.copyWith(
ownReactions: oldMessage?.ownReactions,
ownReactions: ownReactions,
);
addMessage(message);
}));