Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ crm: c db-migrate
# Usage: TEST_INCLUDE=test1,test2 make devtest
.PHONY: devtest
devtest:
ghcid --command 'cabal repl integration' --test='Testlib.Run.mainI []'
ghcid --command 'cabal repl lib:integration' --test='Testlib.Run.mainI []'

.PHONY: sanitize-pr
sanitize-pr:
Expand Down
4 changes: 4 additions & 0 deletions integration/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
, cookie
, cql
, cql-io
, criterion
, cryptobox-haskell
, crypton
, crypton-x509
, cryptostore
Expand Down Expand Up @@ -119,6 +121,8 @@ mkDerivation {
cookie
cql
cql-io
criterion
cryptobox-haskell
crypton
crypton-x509
cryptostore
Expand Down
2 changes: 2 additions & 0 deletions integration/integration.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ library
, cookie
, cql
, cql-io
, criterion
, cryptobox-haskell
, crypton
, crypton-x509
, cryptostore
Expand Down
43 changes: 18 additions & 25 deletions integration/test/API/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,15 @@ deleteTeamMember tid owner mem = do
putConversationProtocol ::
( HasCallStack,
MakesValue user,
MakesValue qcnv,
MakesValue protocol
) =>
user ->
qcnv ->
ConvId ->
protocol ->
App Response
putConversationProtocol user qcnv protocol = do
(domain, cnv) <- objQid qcnv
putConversationProtocol user convId protocol = do
p <- asString protocol
req <- baseRequest user Galley Versioned (joinHttpPath ["conversations", domain, cnv, "protocol"])
req <- baseRequest user Galley Versioned (joinHttpPath ["conversations", convId.domain, convId.id_, "protocol"])
submit "PUT" (req & addJSONObject ["protocol" .= p])

getConversation ::
Expand All @@ -148,21 +146,19 @@ getConversation user qcnv = do

getSubConversation ::
( HasCallStack,
MakesValue user,
MakesValue conv
MakesValue user
) =>
user ->
conv ->
ConvId ->
String ->
App Response
getSubConversation user conv sub = do
(cnvDomain, cnvId) <- objQid conv
req <-
baseRequest user Galley Versioned
$ joinHttpPath
[ "conversations",
cnvDomain,
cnvId,
conv.domain,
conv.id_,
"subconversations",
sub
]
Expand All @@ -184,16 +180,15 @@ deleteSubConversation user sub = do
submit "DELETE" $ req & addJSONObject ["group_id" .= groupId, "epoch" .= epoch]

leaveSubConversation ::
(HasCallStack, MakesValue user, MakesValue sub) =>
(HasCallStack, MakesValue user) =>
user ->
sub ->
ConvId ->
App Response
leaveSubConversation user sub = do
(conv, Just subId) <- objSubConv sub
(domain, convId) <- objQid conv
leaveSubConversation user convId = do
let Just subId = convId.subconvId
req <-
baseRequest user Galley Versioned
$ joinHttpPath ["conversations", domain, convId, "subconversations", subId, "self"]
$ joinHttpPath ["conversations", convId.domain, convId.id_, "subconversations", subId, "self"]
submit "DELETE" req

getSelfConversation :: (HasCallStack, MakesValue user) => user -> App Response
Expand Down Expand Up @@ -278,16 +273,14 @@ mkProteusRecipients dom userClients msg = do
& #text .~ fromString msg

getGroupInfo ::
(HasCallStack, MakesValue user, MakesValue conv) =>
(HasCallStack, MakesValue user) =>
user ->
conv ->
ConvId ->
App Response
getGroupInfo user conv = do
(qcnv, mSub) <- objSubConv conv
(convDomain, convId) <- objQid qcnv
let path = joinHttpPath $ case mSub of
Nothing -> ["conversations", convDomain, convId, "groupinfo"]
Just sub -> ["conversations", convDomain, convId, "subconversations", sub, "groupinfo"]
let path = joinHttpPath $ case conv.subconvId of
Nothing -> ["conversations", conv.domain, conv.id_, "groupinfo"]
Just sub -> ["conversations", conv.domain, conv.id_, "subconversations", sub, "groupinfo"]
req <- baseRequest user Galley Versioned path
submit "GET" req

Expand Down Expand Up @@ -323,7 +316,7 @@ deleteTeamConv ::
App Response
deleteTeamConv team conv user = do
teamId <- objId team
convId <- objId conv
convId <- objId $ objQidObject conv
req <- baseRequest user Galley Versioned (joinHttpPath ["teams", teamId, "conversations", convId])
submit "DELETE" req

Expand Down
Loading