File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
libs/wire-subsystems/test/unit/Wire/MockInterpreters Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -97,20 +97,17 @@ createUserGroupImpl tid nug managedBy = do
97
97
pure ug
98
98
99
99
getUserGroupImpl :: (UserGroupStoreInMemEffectConstraints r ) => TeamId -> UserGroupId -> Bool -> Sem r (Maybe UserGroup )
100
- getUserGroupImpl tid gid includeChannels = fmap filterChannels . Map. lookup (tid, gid) <$> get @ UserGroupInMemState
101
- where
102
- filterChannels ug =
103
- if includeChannels
104
- then ug
105
- else (ug :: UserGroup ) {channels = mempty }
100
+ getUserGroupImpl tid gid includeChannels = fmap (filterChannels includeChannels) . Map. lookup (tid, gid) <$> get @ UserGroupInMemState
101
+
102
+ filterChannels :: Bool -> UserGroup -> UserGroup
103
+ filterChannels includeChannels ug =
104
+ if includeChannels
105
+ then (ug :: UserGroup ) {channelsCount = Just $ maybe 0 length ug. channels}
106
+ else (ug :: UserGroup ) {channels = mempty }
106
107
107
108
getUserGroupsImpl :: (UserGroupStoreInMemEffectConstraints r ) => UserGroupPageRequest -> Sem r UserGroupPage
108
109
getUserGroupsImpl UserGroupPageRequest {.. } = do
109
- let filterChannels ug =
110
- if includeChannels
111
- then (ug :: UserGroup ) {channels = mempty , channelsCount = Just $ maybe 0 length ug. channels}
112
- else (ug :: UserGroup ) {channels = mempty }
113
- meta <- ((snd <$> ) . sieve . fmap (_2 %~ userGroupToMeta . filterChannels) . Map. toList) <$> get @ UserGroupInMemState
110
+ meta <- ((snd <$> ) . sieve . fmap (_2 %~ userGroupToMeta . (filterChannels includeChannels)) . Map. toList) <$> get @ UserGroupInMemState
114
111
pure $ UserGroupPage meta (length meta)
115
112
where
116
113
sieve,
You can’t perform that action at this time.
0 commit comments