[Persistence] Minor refactoring
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -153,17 +153,6 @@ abstract class ChatPersistenceClient {
|
|||||||
|
|
||||||
/// Update list of channel states
|
/// Update list of channel states
|
||||||
Future<void> updateChannelStates(List<ChannelState> channelStates) async {
|
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
|
final deleteReactions = deleteReactionsByMessageId(channelStates
|
||||||
.expand((it) => it.messages)
|
.expand((it) => it.messages)
|
||||||
.map((m) => m.id)
|
.map((m) => m.id)
|
||||||
@@ -178,6 +167,17 @@ abstract class ChatPersistenceClient {
|
|||||||
deleteMembers,
|
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
|
final users = channelStates
|
||||||
.map((cs) => [
|
.map((cs) => [
|
||||||
cs.channel?.createdBy,
|
cs.channel?.createdBy,
|
||||||
|
|||||||
Reference in New Issue
Block a user