diff --git a/integration/test/API/Galley.hs b/integration/test/API/Galley.hs index 2a2951a27e2..a89664be883 100644 --- a/integration/test/API/Galley.hs +++ b/integration/test/API/Galley.hs @@ -240,6 +240,24 @@ addMembers usr qcnv newMembers = do req <- baseRequest usr Galley Versioned (joinHttpPath ["conversations", convDomain, convId, "members"]) submit "POST" (req & addJSONObject ["qualified_users" .= qUsers]) +addMembersV1 :: (HasCallStack, MakesValue user, MakesValue conv) => user -> conv -> Maybe String -> [Value] -> App Response +addMembersV1 usr cnv role newMembers = do + cnvId <- objId cnv + qUsers <- mapM objQidObject newMembers + req <- + addJSONObject + ( ["conversation_role" .= r | r <- maybeToList role] + <> ["qualified_users" .= qUsers] + ) + <$> baseRequest + usr + Galley + (ExplicitVersion 1) + (joinHttpPath ["conversations", cnvId, "members", "v2"]) + submit "POST" (req & addJSONObject ["qualified_users" .= qUsers]) + +-- let invite = InviteQualified (userQualifiedId bob :| []) roleNameWireAdmin + removeMember :: (HasCallStack, MakesValue remover, MakesValue conv, MakesValue removed) => remover -> conv -> removed -> App Response removeMember remover qcnv removed = do (convDomain, convId) <- objQid qcnv diff --git a/integration/test/Test/Conversation.hs b/integration/test/Test/Conversation.hs index 113367ab8a3..dec53e5b7b7 100644 --- a/integration/test/Test/Conversation.hs +++ b/integration/test/Test/Conversation.hs @@ -828,3 +828,21 @@ testUpdateConversationByRemoteAdmin = do void $ withWebSocket alice $ \ws -> do void $ updateReceiptMode bob conv (41 :: Int) >>= getBody 200 awaitMatch 10 isReceiptModeUpdateNotif ws + +testAddRemoteUsersToLocalConv :: HasCallStack => App () +testAddRemoteUsersToLocalConv = do + [alice, bob] <- createAndConnectUsers [OwnDomain, OtherDomain] + conv <- + postConversation alice defProteus + >>= getJSON 201 + [aliceId, bobId] <- for [alice, bob] (%. "qualified_id") + void $ addMembersV1 alice conv (Just "wire_admin") [bobId] >>= getBody 200 + assertConv aliceId conv bobId + assertConv bobId conv aliceId + where + assertConv :: HasCallStack => Value -> Value -> Value -> App () + assertConv getter c other = do + conv <- getConversation getter c >>= getJSON 200 + mems <- conv %. "members.others" & asList + memIds <- for mems (%. "qualified_id") + memIds `shouldMatch` [other]