@@ -3200,17 +3200,19 @@ removeUser = do
3200
3200
let [alice', alexDel', amy'] = qUnqualified <$> [alice, alexDel, amy]
3201
3201
let bDomain = Domain " b.example.com"
3202
3202
bart <- randomQualifiedId bDomain
3203
+ berta <- randomQualifiedId bDomain
3203
3204
let cDomain = Domain " c.example.com"
3204
3205
carl <- randomQualifiedId cDomain
3205
3206
3206
3207
connectUsers alice' (list1 alexDel' [amy'])
3207
3208
connectWithRemoteUser alice' bart
3209
+ connectWithRemoteUser alice' berta
3208
3210
connectWithRemoteUser alexDel' bart
3209
3211
connectWithRemoteUser alice' carl
3210
3212
connectWithRemoteUser alexDel' carl
3211
3213
3212
3214
convA1 <- decodeConvId <$> postConv alice' [alexDel'] (Just " gossip" ) [] Nothing Nothing
3213
- convA2 <- decodeConvId <$> postConv alice' [alexDel' , amy'] ( Just " gossip2 " ) [] Nothing Nothing
3215
+ convA2 <- decodeConvId <$> postConvWithRemoteUsers alice' defNewConv {newConvQualifiedUsers = [alexDel, amy, berta]}
3214
3216
convA3 <- decodeConvId <$> postConv alice' [amy'] (Just " gossip3" ) [] Nothing Nothing
3215
3217
convA4 <- decodeConvId <$> postConvWithRemoteUsers alice' defNewConv {newConvQualifiedUsers = [alexDel, bart, carl]}
3216
3218
convB1 <- randomId -- a remote conversation at 'bDomain' that Alice, AlexDel and Bart will be in
@@ -3253,18 +3255,18 @@ removeUser = do
3253
3255
deleteUser alexDel' !!! const 200 === statusCode
3254
3256
3255
3257
liftIO $ do
3256
- assertEqual (" expect exactly 4 federated requests in : " <> show fedRequests) 4 (length fedRequests)
3258
+ assertEqual (" expect exactly 5 federated requests in : " <> show fedRequests) 5 (length fedRequests)
3257
3259
3258
3260
liftIO $ do
3259
- bReq <- assertOne $ filter (\ req -> F. domain req == domainText bDomain && fmap F. path ( F. request req) == Just " /federation/on-user-deleted/conversations" ) fedRequests
3261
+ bReq <- assertOne $ filter (matchFedRequest bDomain " /federation/on-user-deleted/conversations" ) fedRequests
3260
3262
fmap F. component (F. request bReq) @?= Just F. Galley
3261
3263
fmap F. path (F. request bReq) @?= Just " /federation/on-user-deleted/conversations"
3262
3264
Just (Right udcnB) <- pure $ fmap (eitherDecode . LBS. fromStrict . F. body) (F. request bReq)
3263
3265
sort (fromRange (FederatedGalley. udcnConversations udcnB)) @?= sort [convB1, convB2]
3264
3266
FederatedGalley. udcnUser udcnB @?= qUnqualified alexDel
3265
3267
3266
3268
liftIO $ do
3267
- cReq <- assertOne $ filter (\ req -> F. domain req == domainText cDomain && fmap F. path ( F. request req) == Just " /federation/on-user-deleted/conversations" ) fedRequests
3269
+ cReq <- assertOne $ filter (matchFedRequest cDomain " /federation/on-user-deleted/conversations" ) fedRequests
3268
3270
fmap F. component (F. request cReq) @?= Just F. Galley
3269
3271
fmap F. path (F. request cReq) @?= Just " /federation/on-user-deleted/conversations"
3270
3272
Just (Right udcnC) <- pure $ fmap (eitherDecode . LBS. fromStrict . F. body) (F. request cReq)
@@ -3278,19 +3280,21 @@ removeUser = do
3278
3280
wsAssertMembersLeave qconvA2 alexDel [alexDel]
3279
3281
3280
3282
liftIO $ do
3281
- bLeaveReq <- assertOne $ filter (\ req -> F. domain req == domainText bDomain && fmap F. path (F. request req) == Just " /federation/on-conversation-updated" ) fedRequests
3282
- fmap F. component (F. request bLeaveReq) @?= Just F. Galley
3283
- fmap F. path (F. request bLeaveReq) @?= Just " /federation/on-conversation-updated"
3284
- Just (Right convUpdate) <- pure $ fmap (eitherDecode . LBS. fromStrict . F. body) (F. request bLeaveReq)
3285
- cuConvId convUpdate @?= convA4
3286
- cuAction convUpdate @?= ConversationActionRemoveMembers (pure alexDel)
3287
- cuAlreadyPresentUsers convUpdate @?= [qUnqualified bart]
3283
+ let bConvUpdateRPCs = filter (matchFedRequest bDomain " /federation/on-conversation-updated" ) fedRequests
3284
+ bConvUpdatesEither :: [Either String ConversationUpdate ] <- eitherDecode . LBS. fromStrict . F. body <$$> mapM (assertJust . F. request) bConvUpdateRPCs
3285
+ bConvUpdates <- mapM assertRight bConvUpdatesEither
3286
+
3287
+ bConvUpdatesA2 <- assertOne $ filter (\ cu -> cuConvId cu == convA2) bConvUpdates
3288
+ cuAction bConvUpdatesA2 @?= ConversationActionRemoveMembers (pure alexDel)
3289
+ cuAlreadyPresentUsers bConvUpdatesA2 @?= [qUnqualified berta]
3290
+
3291
+ bConvUpdatesA4 <- assertOne $ filter (\ cu -> cuConvId cu == convA4) bConvUpdates
3292
+ cuAction bConvUpdatesA4 @?= ConversationActionRemoveMembers (pure alexDel)
3293
+ cuAlreadyPresentUsers bConvUpdatesA4 @?= [qUnqualified bart]
3288
3294
3289
3295
liftIO $ do
3290
- cLeaveReq <- assertOne $ filter (\ req -> F. domain req == domainText cDomain && fmap F. path (F. request req) == Just " /federation/on-conversation-updated" ) fedRequests
3291
- fmap F. component (F. request cLeaveReq) @?= Just F. Galley
3292
- fmap F. path (F. request cLeaveReq) @?= Just " /federation/on-conversation-updated"
3293
- Just (Right convUpdate) <- pure $ fmap (eitherDecode . LBS. fromStrict . F. body) (F. request cLeaveReq)
3296
+ cConvUpdateRPC <- assertOne $ filter (matchFedRequest cDomain " /federation/on-conversation-updated" ) fedRequests
3297
+ Just (Right convUpdate) <- pure $ fmap (eitherDecode . LBS. fromStrict . F. body) (F. request cConvUpdateRPC)
3294
3298
cuConvId convUpdate @?= convA4
3295
3299
cuAction convUpdate @?= ConversationActionRemoveMembers (pure alexDel)
3296
3300
cuAlreadyPresentUsers convUpdate @?= [qUnqualified carl]
0 commit comments