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
1 change: 1 addition & 0 deletions changelog.d/5-internal/refactor-mls-message
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor and simplify MLS message handling logic
3 changes: 3 additions & 0 deletions libs/wire-api/src/Wire/API/Routes/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module Wire.API.Routes.Public
ZLocalUser,
ZConn,
ZOptUser,
ZOptClient,
ZOptConn,
ZBot,
ZConversation,
Expand Down Expand Up @@ -179,6 +180,8 @@ type ZProvider = ZAuthServant 'ZAuthProvider InternalAuthDefOpts

type ZOptUser = ZAuthServant 'ZAuthUser '[Servant.Optional, Servant.Strict]

type ZOptClient = ZAuthServant 'ZAuthClient '[Servant.Optional, Servant.Strict]

type ZOptConn = ZAuthServant 'ZAuthConn '[Servant.Optional, Servant.Strict]

instance HasSwagger api => HasSwagger (ZAuthServant 'ZAuthUser _opts :> api) where
Expand Down
3 changes: 3 additions & 0 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/MLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type MLSMessagingAPI =
:> CanThrow 'MissingLegalholdConsent
:> CanThrow MLSProposalFailure
:> "messages"
:> ZOptClient
:> ZConn
:> ReqBody '[MLS] (RawMLS SomeMessage)
:> MultiVerb1 'POST '[JSON] (Respond 201 "Message sent" [Event])
Expand All @@ -91,6 +92,7 @@ type MLSMessagingAPI =
:> CanThrow 'MissingLegalholdConsent
:> CanThrow MLSProposalFailure
:> "messages"
:> ZOptClient
:> ZConn
:> ReqBody '[MLS] (RawMLS SomeMessage)
:> MultiVerb1 'POST '[JSON] (Respond 201 "Message sent" MLSMessageSendingStatus)
Expand Down Expand Up @@ -118,6 +120,7 @@ type MLSMessagingAPI =
:> CanThrow 'MissingLegalholdConsent
:> CanThrow MLSProposalFailure
:> "commit-bundles"
:> ZOptClient
:> ZConn
:> ReqBody '[CommitBundleMimeType] CommitBundle
:> MultiVerb1 'POST '[JSON] (Respond 201 "Commit accepted and forwarded" MLSMessageSendingStatus)
Expand Down
4 changes: 2 additions & 2 deletions services/galley/src/Galley/API/Federation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ sendMLSCommitBundle remoteDomain msr =
qcnv <- E.getConversationIdByGroupId (msgGroupId msg) >>= noteS @'ConvNotFound
when (qUnqualified qcnv /= F.msrConvId msr) $ throwS @'MLSGroupConversationMismatch
F.MLSMessageResponseUpdates . map lcuUpdate
<$> postMLSCommitBundle loc (qUntagged sender) qcnv Nothing bundle
<$> postMLSCommitBundle loc (qUntagged sender) Nothing qcnv Nothing bundle

sendMLSMessage ::
( Members
Expand Down Expand Up @@ -680,7 +680,7 @@ sendMLSMessage remoteDomain msr =
qcnv <- E.getConversationIdByGroupId (msgGroupId msg) >>= noteS @'ConvNotFound
when (qUnqualified qcnv /= F.msrConvId msr) $ throwS @'MLSGroupConversationMismatch
F.MLSMessageResponseUpdates . map lcuUpdate
<$> postMLSMessage loc (qUntagged sender) qcnv Nothing raw
<$> postMLSMessage loc (qUntagged sender) Nothing qcnv Nothing raw

class ToGalleyRuntimeError (effs :: EffectRow) r where
mapToGalleyError ::
Expand Down
Loading