Add GET endpoint for subconversations#2869
Conversation
60403da to
5b55ed1
Compare
6362cbd to
63f1f3c
Compare
63f1f3c to
0ced46d
Compare
dab9fb5 to
5561966
Compare
d3273b1 to
035d5af
Compare
dd563a5 to
05db618
Compare
| GroupId | ||
| . convert | ||
| . Crypto.hash @ByteString @Crypto.SHA256 | ||
| $ toByteString' (tUnqualified lcnv) <> toByteString' (unSubConvId sconv) |
There was a problem hiding this comment.
This means that two subconversations with the same ConvId and SubConvId, but that reside on different domains, have the same group ID. This could lead to various problems so let's make this depend on the domain too.
| injectiveInitialGroupId (cnv, scnv1, scnv2) = do | ||
| let domain = Domain "group.example.com" | ||
| lcnv = toLocalUnsafe domain cnv | ||
| initialGroupId lcnv scnv1 =/= initialGroupId lcnv scnv2 |
There was a problem hiding this comment.
This tests that they'll (probably) never overlap, but we could also test that the deterministic nature of the function also holds true.
initialGroupId lcnv scnv1 === initialGroupId lcnv scnv1
There was a problem hiding this comment.
In the way we have it now, i.e., without running in any monad that could leave room for non-determinism, we don't have to test that as all "pure" functions are deterministic. If we were to run it in some monad m we'd have to change the test anyway.
| updateSubConvPublicGroupState :: PrepQuery W (ConvId, SubConvId, Maybe OpaquePublicGroupState) () | ||
| updateSubConvPublicGroupState = "INSERT INTO subconversation (conv_id, subconv_id, public_group_state) VALUES (?, ?, ?)" | ||
|
|
||
| selectSubConvPublicGroupState :: PrepQuery R (ConvId, SubConvId) (Identity (Maybe OpaquePublicGroupState)) | ||
| selectSubConvPublicGroupState = "SELECT public_group_state FROM subconversation WHERE conv_id = ? AND subconv_id = ?" |
There was a problem hiding this comment.
These don't really belong to this PR, but I won't insist on removing them from the PR as they'll be needed in the next PR anyway.
This PR:
ConvOrSubinstead of plain conversationsTracked by https://wearezeta.atlassian.net/browse/FS-901.
Checklist
initialGroupIdGalley.API.Federation("TODO: remove this before the rebase")SubConvIdandPublicSubConversationtypeschangelog.d