[Persistence] Minor refactoring
Signed-off-by: Sahil Kumar <xdsahil@gmail.com>
This commit is contained in:
@@ -153,17 +153,6 @@ abstract class ChatPersistenceClient {
|
||||
|
||||
/// Update list of channel states
|
||||
Future<void> updateChannelStates(List<ChannelState> channelStates) async {
|
||||
final channels = channelStates.map((it) {
|
||||
return it.channel;
|
||||
}).where((it) => it != null);
|
||||
|
||||
final reactions = channelStates.expand((it) => it.messages).expand((it) {
|
||||
return [
|
||||
...it.ownReactions.where((r) => r.userId != null),
|
||||
...it.latestReactions.where((r) => r.userId != null)
|
||||
];
|
||||
}).where((it) => it != null);
|
||||
|
||||
final deleteReactions = deleteReactionsByMessageId(channelStates
|
||||
.expand((it) => it.messages)
|
||||
.map((m) => m.id)
|
||||
@@ -178,6 +167,17 @@ abstract class ChatPersistenceClient {
|
||||
deleteMembers,
|
||||
]);
|
||||
|
||||
final channels = channelStates.map((it) {
|
||||
return it.channel;
|
||||
}).where((it) => it != null);
|
||||
|
||||
final reactions = channelStates.expand((it) => it.messages).expand((it) {
|
||||
return [
|
||||
...it.ownReactions.where((r) => r.userId != null),
|
||||
...it.latestReactions.where((r) => r.userId != null)
|
||||
];
|
||||
}).where((it) => it != null);
|
||||
|
||||
final users = channelStates
|
||||
.map((cs) => [
|
||||
cs.channel?.createdBy,
|
||||
|
||||
Reference in New Issue
Block a user