From a41c4cd10205eedcb9e0db88b90807886b343093 Mon Sep 17 00:00:00 2001 From: Stefan Berthold Date: Tue, 17 Jan 2023 16:20:30 +0000 Subject: [PATCH] invoke on-new-remote-conversation in addMembers --- services/galley/src/Galley/API/MLS/Message.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/services/galley/src/Galley/API/MLS/Message.hs b/services/galley/src/Galley/API/MLS/Message.hs index 9b80af005d8..008243ce52f 100644 --- a/services/galley/src/Galley/API/MLS/Message.hs +++ b/services/galley/src/Galley/API/MLS/Message.hs @@ -1393,7 +1393,23 @@ addMembers qusr con lconvOrSub users = case tUnqualified lconvOrSub of . filter (flip Set.notMember (existingMembers lconv)) . toList $ users - SubConv _ _ -> pure [] + SubConv mlsConv subConv -> do + -- call `on-new-remote-conversation` on backends that are seeing this + -- conversation for the first time + let newDomains = + Set.difference + (Set.fromList (map void (snd (partitionQualified lconvOrSub users)))) + (Set.fromList (map (void . rmId) (mcRemoteMembers mlsConv))) + let nrc = + NewRemoteConversation + { nrcConvId = mcId mlsConv, + nrcSubConvId = Just . scSubConvId $ subConv, + nrcProtocol = ProtocolMLS (mcMLSData mlsConv) + } + runFederatedConcurrently_ (toList newDomains) $ \_ -> do + void $ fedClient @'Galley @"on-new-remote-conversation" nrc + + pure [] removeMembers :: HasProposalActionEffects r =>