-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough 👍
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
ConvOrSub
instead of plain conversationsTracked by https://wearezeta.atlassian.net/browse/FS-901.
Checklist
initialGroupId
Galley.API.Federation
("TODO: remove this before the rebase")SubConvId
andPublicSubConversation
typeschangelog.d