From 6b7a82479c0729d0e65985fcfa39cdc00ff170f0 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Mon, 6 Sep 2021 09:48:45 +0200 Subject: [PATCH 1/8] Remove Public import alias in galley routes --- .../src/Wire/API/Routes/Public/Galley.hs | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs b/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs index 3e8fa9921b1..443c968848a 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs @@ -33,22 +33,22 @@ import Servant import Servant.API.Generic (ToServantApi, (:-)) import Servant.Swagger.Internal import Servant.Swagger.Internal.Orphans () -import Wire.API.Conversation as Public -import qualified Wire.API.Conversation.Role as Public +import Wire.API.Conversation +import Wire.API.Conversation.Role import Wire.API.ErrorDescription -import qualified Wire.API.Event.Conversation as Public +import Wire.API.Event.Conversation import Wire.API.Message import Wire.API.Routes.MultiVerb import Wire.API.Routes.Public (ZConn, ZUser) import Wire.API.Routes.Public.Galley.Responses import Wire.API.Routes.QualifiedCapture import Wire.API.ServantProto (Proto, RawProto) -import qualified Wire.API.Team.Conversation as Public +import Wire.API.Team.Conversation import Wire.API.Team.Feature instance AsHeaders '[Header "Location" ConvId] Conversation Conversation where -- FUTUREWORK: use addHeader - toHeaders c = Headers c (HCons (Header (qUnqualified (Public.cnvQualifiedId c))) HNil) + toHeaders c = Headers c (HCons (Header (qUnqualified (cnvQualifiedId c))) HNil) fromHeaders = getResponse instance @@ -87,12 +87,12 @@ type ConversationVerb = type UpdateResponses = '[ RespondEmpty 204 "Conversation unchanged", - Respond 200 "Conversation updated" Public.Event + Respond 200 "Conversation updated" Event ] data UpdateResult = Unchanged - | Updated Public.Event + | Updated Event instance AsUnion UpdateResponses UpdateResult where toUnion Unchanged = inject (I ()) @@ -111,14 +111,14 @@ data Api routes = Api :> ZUser :> "conversations" :> Capture "cnv" ConvId - :> Get '[Servant.JSON] Public.Conversation, + :> Get '[Servant.JSON] Conversation, getConversation :: routes :- Summary "Get a conversation by ID" :> ZUser :> "conversations" :> QualifiedCapture "cnv" ConvId - :> Get '[Servant.JSON] Public.Conversation, + :> Get '[Servant.JSON] Conversation, getConversationRoles :: routes :- Summary "Get existing roles available for the given conversation" @@ -126,7 +126,7 @@ data Api routes = Api :> "conversations" :> Capture "cnv" ConvId :> "roles" - :> Get '[Servant.JSON] Public.ConversationRolesList, + :> Get '[Servant.JSON] ConversationRolesList, listConversationIdsUnqualified :: routes :- Summary "[deprecated] Get all local conversation IDs." @@ -148,7 +148,7 @@ data Api routes = Api ] "size" (Range 1 1000 Int32) - :> Get '[Servant.JSON] (Public.ConversationList ConvId), + :> Get '[Servant.JSON] (ConversationList ConvId), listConversationIds :: routes :- Summary "Get all conversation IDs." @@ -156,8 +156,8 @@ data Api routes = Api :> ZUser :> "conversations" :> "list-ids" - :> ReqBody '[Servant.JSON] Public.GetPaginatedConversationIds - :> Post '[Servant.JSON] Public.ConvIdsPage, + :> ReqBody '[Servant.JSON] GetPaginatedConversationIds + :> Post '[Servant.JSON] ConvIdsPage, getConversations :: routes :- Summary "Get all *local* conversations." @@ -185,7 +185,7 @@ data Api routes = Api ] "size" (Range 1 500 Int32) - :> Get '[Servant.JSON] (Public.ConversationList Public.Conversation), + :> Get '[Servant.JSON] (ConversationList Conversation), listConversations :: routes :- Summary "[deprecated] Get all conversations (also returns remote conversations)" @@ -196,8 +196,8 @@ data Api routes = Api \**NOTE** This endpoint will soon be removed." :> ZUser :> "list-conversations" - :> ReqBody '[Servant.JSON] Public.ListConversations - :> Post '[Servant.JSON] (Public.ConversationList Public.Conversation), + :> ReqBody '[Servant.JSON] ListConversations + :> Post '[Servant.JSON] (ConversationList Conversation), listConversationsV2 :: routes :- Summary "Get conversation metadata for a list of conversation ids" @@ -205,8 +205,8 @@ data Api routes = Api :> "conversations" :> "list" :> "v2" - :> ReqBody '[Servant.JSON] Public.ListConversationsV2 - :> Post '[Servant.JSON] Public.ConversationsResponse, + :> ReqBody '[Servant.JSON] ListConversationsV2 + :> Post '[Servant.JSON] ConversationsResponse, -- This endpoint can lead to the following events being sent: -- - ConvCreate event to members getConversationByReusableCode :: @@ -221,7 +221,7 @@ data Api routes = Api :> "join" :> QueryParam' [Required, Strict] "key" Code.Key :> QueryParam' [Required, Strict] "code" Code.Value - :> Get '[Servant.JSON] Public.ConversationCoverView, + :> Get '[Servant.JSON] ConversationCoverView, createGroupConversation :: routes :- Summary "Create a new conversation" @@ -232,7 +232,7 @@ data Api routes = Api :> ZUser :> ZConn :> "conversations" - :> ReqBody '[Servant.JSON] Public.NewConvUnmanaged + :> ReqBody '[Servant.JSON] NewConvUnmanaged :> ConversationVerb, createSelfConversation :: routes @@ -251,7 +251,7 @@ data Api routes = Api :> ZConn :> "conversations" :> "one2one" - :> ReqBody '[Servant.JSON] Public.NewConvUnmanaged + :> ReqBody '[Servant.JSON] NewConvUnmanaged :> ConversationVerb, addMembersToConversationV2 :: routes @@ -262,7 +262,7 @@ data Api routes = Api :> Capture "cnv" ConvId :> "members" :> "v2" - :> ReqBody '[Servant.JSON] Public.InviteQualified + :> ReqBody '[Servant.JSON] InviteQualified :> MultiVerb 'POST '[Servant.JSON] UpdateResponses UpdateResult, -- This endpoint can lead to the following events being sent: -- - MemberLeave event to members @@ -307,7 +307,7 @@ data Api routes = Api :> Capture "tid" TeamId :> "conversations" :> "roles" - :> Get '[Servant.JSON] Public.ConversationRolesList, + :> Get '[Servant.JSON] ConversationRolesList, getTeamConversations :: routes :- Summary "Get team conversations" @@ -316,7 +316,7 @@ data Api routes = Api :> "teams" :> Capture "tid" TeamId :> "conversations" - :> Get '[Servant.JSON] Public.TeamConversationList, + :> Get '[Servant.JSON] TeamConversationList, getTeamConversation :: routes :- Summary "Get one team conversation" @@ -326,7 +326,7 @@ data Api routes = Api :> Capture "tid" TeamId :> "conversations" :> Capture "cid" ConvId - :> Get '[Servant.JSON] Public.TeamConversation, + :> Get '[Servant.JSON] TeamConversation, deleteTeamConversation :: routes :- Summary "Remove a team conversation" From 35b22162a15cfbf46d0191e1e714578c9dbaa802 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Mon, 6 Sep 2021 10:05:25 +0200 Subject: [PATCH 2/8] Test non-deprecated conversation rename endpoint --- services/galley/test/integration/API/Util.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index 361aede80a0..facd0fd904e 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -973,7 +973,7 @@ putConversationName u c n = do let update = ConversationRename n put ( g - . paths ["conversations", toByteString' c] + . paths ["conversations", toByteString' c, "name"] . zUser u . zConn "conn" . zType "access" From 38f79d903d246c67136b8cf24e9480298fd65f17 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Mon, 6 Sep 2021 10:05:57 +0200 Subject: [PATCH 3/8] Servantify conversation rename --- libs/wire-api/src/Wire/API/Conversation.hs | 2 +- .../src/Wire/API/Routes/Public/Galley.hs | 34 ++++++++++++ services/galley/src/Galley/API/Public.hs | 18 +------ services/galley/src/Galley/API/Update.hs | 54 +++++++++++++------ 4 files changed, 75 insertions(+), 33 deletions(-) diff --git a/libs/wire-api/src/Wire/API/Conversation.hs b/libs/wire-api/src/Wire/API/Conversation.hs index 9cc597a4794..36a397eb65f 100644 --- a/libs/wire-api/src/Wire/API/Conversation.hs +++ b/libs/wire-api/src/Wire/API/Conversation.hs @@ -757,7 +757,7 @@ newtype ConversationRename = ConversationRename } deriving stock (Eq, Show) deriving newtype (Arbitrary) - deriving (ToJSON, FromJSON) via Schema ConversationRename + deriving (S.ToSchema, ToJSON, FromJSON) via Schema ConversationRename instance ToSchema ConversationRename where schema = diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs b/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs index 443c968848a..4f2a1458f11 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs @@ -296,6 +296,40 @@ data Api routes = Api '[JSON] RemoveFromConversationHTTPResponse RemoveFromConversationResponse, + -- This endpoint can lead to the following events being sent: + -- - ConvRename event to members + updateConversationNameUnqualified :: + routes + :- Summary "Update conversation name" + :> ZUser + :> ZConn + :> "conversations" + :> Capture' '[Description "Conversation ID"] "cnv" ConvId + :> "name" + :> ReqBody '[JSON] ConversationRename + :> MultiVerb + 'PUT + '[JSON] + [ ConvNotFound, + Respond 200 "Conversation updated" Event + ] + (Maybe Event), + updateConversationName :: + routes + :- Summary "Update conversation name" + :> ZUser + :> ZConn + :> "conversations" + :> QualifiedCapture' '[Description "Conversation ID"] "cnv" ConvId + :> "name" + :> ReqBody '[JSON] ConversationRename + :> MultiVerb + 'PUT + '[JSON] + [ ConvNotFound, + Respond 200 "Conversation updated" Event + ] + (Maybe Event), -- Team Conversations getTeamConversationRoles :: diff --git a/services/galley/src/Galley/API/Public.hs b/services/galley/src/Galley/API/Public.hs index 7f93785ce39..242e401758d 100644 --- a/services/galley/src/Galley/API/Public.hs +++ b/services/galley/src/Galley/API/Public.hs @@ -92,6 +92,8 @@ servantSitemap = GalleyAPI.addMembersToConversationV2 = Update.addMembers, GalleyAPI.removeMemberUnqualified = Update.removeMemberUnqualified, GalleyAPI.removeMember = Update.removeMemberQualified, + GalleyAPI.updateConversationNameUnqualified = Update.updateLocalConversationName, + GalleyAPI.updateConversationName = Update.updateConversationName, GalleyAPI.getTeamConversationRoles = Teams.getTeamConversationRoles, GalleyAPI.getTeamConversations = Teams.getTeamConversations, GalleyAPI.getTeamConversation = Teams.getTeamConversation, @@ -543,22 +545,6 @@ sitemap = do -- Conversation API --------------------------------------------------- - -- This endpoint can lead to the following events being sent: - -- - ConvRename event to members - put "/conversations/:cnv/name" (continue Update.updateConversationNameH) $ - zauthUserId - .&. zauthConnId - .&. capture "cnv" - .&. jsonRequest @Public.ConversationRename - document "PUT" "updateConversationName" $ do - summary "Update conversation name" - parameter Path "cnv" bytes' $ - description "Conversation ID" - body (ref Public.modelConversationUpdateName) $ - description "JSON body" - returns (ref Public.modelEvent) - errorResponse (Error.errorDescriptionToWai Error.convNotFound) - -- This endpoint can lead to the following events being sent: -- - ConvRename event to members put "/conversations/:cnv" (continue Update.updateConversationDeprecatedH) $ diff --git a/services/galley/src/Galley/API/Update.hs b/services/galley/src/Galley/API/Update.hs index 11cd0086f7f..e1bb081dded 100644 --- a/services/galley/src/Galley/API/Update.hs +++ b/services/galley/src/Galley/API/Update.hs @@ -27,7 +27,8 @@ module Galley.API.Update rmCodeH, getCodeH, updateConversationDeprecatedH, - updateConversationNameH, + updateLocalConversationName, + updateConversationName, updateConversationAccessH, updateConversationReceiptModeH, updateConversationMessageTimerH, @@ -125,6 +126,7 @@ import qualified Wire.API.ErrorDescription as Public import qualified Wire.API.Event.Conversation as Public import Wire.API.Federation.API.Galley (RemoteMessage (..)) import qualified Wire.API.Federation.API.Galley as FederatedGalley +import Wire.API.Federation.Error import qualified Wire.API.Message as Public import Wire.API.Routes.Public.Galley (UpdateResult (..)) import Wire.API.Routes.Public.Galley.Responses @@ -924,32 +926,52 @@ newMessage qusr con qcnv msg now (m, c, t) ~(toBots, toUsers) = updateConversationDeprecatedH :: UserId ::: ConnId ::: ConvId ::: JsonRequest Public.ConversationRename -> Galley Response updateConversationDeprecatedH (zusr ::: zcon ::: cnv ::: req) = do convRename <- fromJsonBody req - setStatus status200 . json <$> updateConversationName zusr zcon cnv convRename + setStatus status200 . json <$> updateLocalConversationName zusr zcon cnv convRename -updateConversationNameH :: UserId ::: ConnId ::: ConvId ::: JsonRequest Public.ConversationRename -> Galley Response -updateConversationNameH (zusr ::: zcon ::: cnv ::: req) = do - convRename <- fromJsonBody req - setStatus status200 . json <$> updateConversationName zusr zcon cnv convRename +updateConversationName :: + UserId -> + ConnId -> + Qualified ConvId -> + Public.ConversationRename -> + Galley (Maybe Public.Event) +updateConversationName usr zcon qcnv convRename = do + localDomain <- viewFederationDomain + if qDomain qcnv == localDomain + then updateLocalConversationName usr zcon (qUnqualified qcnv) convRename + else throwM federationNotImplemented + +updateLocalConversationName :: + UserId -> + ConnId -> + ConvId -> + Public.ConversationRename -> + Galley (Maybe Public.Event) +updateLocalConversationName usr zcon cnv convRename = do + alive <- Data.isConvAlive cnv + if alive + then Just <$> updateLiveLocalConversationName usr zcon cnv convRename + else Nothing <$ Data.deleteConversation cnv -updateConversationName :: UserId -> ConnId -> ConvId -> Public.ConversationRename -> Galley Public.Event -updateConversationName zusr zcon cnv convRename = do +updateLiveLocalConversationName :: + UserId -> + ConnId -> + ConvId -> + Public.ConversationRename -> + Galley Public.Event +updateLiveLocalConversationName usr zcon cnv convRename = do localDomain <- viewFederationDomain let qcnv = Qualified cnv localDomain - qusr = Qualified zusr localDomain - alive <- Data.isConvAlive cnv - unless alive $ do - Data.deleteConversation cnv - throwErrorDescription convNotFound + qusr = Qualified usr localDomain (bots, users) <- localBotsAndUsers <$> Data.members cnv - ensureActionAllowedThrowing ModifyConversationName =<< getSelfMemberFromLocalsLegacy zusr users + ensureActionAllowedThrowing ModifyConversationName =<< getSelfMemberFromLocalsLegacy usr users now <- liftIO getCurrentTime cn <- rangeChecked (cupName convRename) Data.updateConversation cnv cn let e = Event ConvRename qcnv qusr now (EdConvRename convRename) - for_ (newPushLocal ListComplete zusr (ConvEvent e) (recipient <$> users)) $ \p -> + for_ (newPushLocal ListComplete usr (ConvEvent e) (recipient <$> users)) $ \p -> push1 $ p & pushConn ?~ zcon void . forkIO $ void $ External.deliver (bots `zip` repeat e) - return e + pure e isTypingH :: UserId ::: ConnId ::: ConvId ::: JsonRequest Public.TypingData -> Galley Response isTypingH (zusr ::: zcon ::: cnv ::: req) = do From 7811ab4c36ae33f239749cb7a91b00fd22c2d714 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Mon, 6 Sep 2021 10:15:37 +0200 Subject: [PATCH 4/8] More conversation rename tests --- services/galley/test/integration/API.hs | 61 +++++++++++++++++++- services/galley/test/integration/API/Util.hs | 18 ++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index f9502042fce..14fab9be2ee 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -169,7 +169,10 @@ tests s = test s "delete conversations/:domain/:cnv/members/:domain/:usr - remote conv, leave conv" leaveRemoteConvQualifiedOk, test s "delete conversations/:domain/:cnv/members/:domain/:usr - remote conv, remove local user, fail" removeLocalMemberConvQualifiedFail, test s "delete conversations/:domain/:cnv/members/:domain/:usr - remote conv, remove remote user, fail" removeRemoteMemberConvQualifiedFail, + test s "rename conversation (deprecated endpoint)" putConvDeprecatedRenameOk, test s "rename conversation" putConvRenameOk, + test s "rename qualified conversation" putQualifiedConvRenameOk, + test s "rename qualified conversation failure" putQualifiedConvRenameFailure, test s "member update (otr mute)" putMemberOtrMuteOk, test s "member update (otr archive)" putMemberOtrArchiveOk, test s "member update (hidden)" putMemberHiddenOk, @@ -2418,6 +2421,63 @@ deleteMembersUnqualifiedFailO2O = do o2o <- decodeConvId <$> postO2OConv alice bob (Just "foo") deleteMemberUnqualified alice bob o2o !!! const 403 === statusCode +putQualifiedConvRenameFailure :: TestM () +putQualifiedConvRenameFailure = do + conv <- randomId + qbob <- randomQualifiedUser + let qconv = Qualified conv (qDomain qbob) + putQualifiedConversationName (qUnqualified qbob) qconv "gossip" + !!! const 404 === statusCode + +putQualifiedConvRenameOk :: TestM () +putQualifiedConvRenameOk = do + c <- view tsCannon + alice <- randomUser + qbob <- randomQualifiedUser + let bob = qUnqualified qbob + connectUsers alice (singleton bob) + conv <- decodeConvId <$> postO2OConv alice bob (Just "gossip") + let qconv = Qualified conv (qDomain qbob) + WS.bracketR2 c alice bob $ \(wsA, wsB) -> do + void $ putQualifiedConversationName bob qconv "gossip++" !!! const 200 === statusCode + void . liftIO . WS.assertMatchN (5 # Second) [wsA, wsB] $ \n -> do + let e = List1.head (WS.unpackPayload n) + ntfTransient n @?= False + evtConv e @?= qconv + evtType e @?= ConvRename + evtFrom e @?= qbob + evtData e @?= EdConvRename (ConversationRename "gossip++") + +putConvDeprecatedRenameOk :: TestM () +putConvDeprecatedRenameOk = do + c <- view tsCannon + g <- view tsGalley + alice <- randomUser + qbob <- randomQualifiedUser + let bob = qUnqualified qbob + connectUsers alice (singleton bob) + conv <- decodeConvId <$> postO2OConv alice bob (Just "gossip") + let qconv = Qualified conv (qDomain qbob) + WS.bracketR2 c alice bob $ \(wsA, wsB) -> do + -- This endpoint is deprecated but clients still use it + put + ( g + . paths ["conversations", toByteString' conv] + . zUser bob + . zConn "conn" + . zType "access" + . json (ConversationRename "gossip++") + ) + !!! const 200 + === statusCode + void . liftIO . WS.assertMatchN (5 # Second) [wsA, wsB] $ \n -> do + let e = List1.head (WS.unpackPayload n) + ntfTransient n @?= False + evtConv e @?= qconv + evtType e @?= ConvRename + evtFrom e @?= qbob + evtData e @?= EdConvRename (ConversationRename "gossip++") + putConvRenameOk :: TestM () putConvRenameOk = do c <- view tsCannon @@ -2427,7 +2487,6 @@ putConvRenameOk = do connectUsers alice (singleton bob) conv <- decodeConvId <$> postO2OConv alice bob (Just "gossip") let qconv = Qualified conv (qDomain qbob) - -- This endpoint should be deprecated but clients still use it WS.bracketR2 c alice bob $ \(wsA, wsB) -> do void $ putConversationName bob conv "gossip++" !!! const 200 === statusCode void . liftIO . WS.assertMatchN (5 # Second) [wsA, wsB] $ \n -> do diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index facd0fd904e..0d516aad89a 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -967,6 +967,24 @@ putOtherMember from to m c = do . zType "access" . json m +putQualifiedConversationName :: UserId -> Qualified ConvId -> Text -> TestM ResponseLBS +putQualifiedConversationName u c n = do + g <- view tsGalley + let update = ConversationRename n + put + ( g + . paths + [ "conversations", + toByteString' (qDomain c), + toByteString' (qUnqualified c), + "name" + ] + . zUser u + . zConn "conn" + . zType "access" + . json update + ) + putConversationName :: UserId -> ConvId -> Text -> TestM ResponseLBS putConversationName u c n = do g <- view tsGalley From 460d6694ac1dbfbe4d6a13d8b1107e4632936d9c Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Mon, 6 Sep 2021 10:19:29 +0200 Subject: [PATCH 5/8] Servantify deprecated conversation rename endpoint --- .../src/Wire/API/Routes/Public/Galley.hs | 19 ++++++++++++++++++- services/galley/src/Galley/API/Public.hs | 17 +---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs b/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs index 4f2a1458f11..24a10876415 100644 --- a/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs +++ b/libs/wire-api/src/Wire/API/Routes/Public/Galley.hs @@ -298,9 +298,26 @@ data Api routes = Api RemoveFromConversationResponse, -- This endpoint can lead to the following events being sent: -- - ConvRename event to members + updateConversationNameDeprecated :: + routes + :- Summary "Update conversation name (deprecated)" + :> Description "Use `/conversations/:domain/:conv/name` instead." + :> ZUser + :> ZConn + :> "conversations" + :> Capture' '[Description "Conversation ID"] "cnv" ConvId + :> ReqBody '[JSON] ConversationRename + :> MultiVerb + 'PUT + '[JSON] + [ ConvNotFound, + Respond 200 "Conversation updated" Event + ] + (Maybe Event), updateConversationNameUnqualified :: routes - :- Summary "Update conversation name" + :- Summary "Update conversation name (deprecated)" + :> Description "Use `/conversations/:domain/:conv/name` instead." :> ZUser :> ZConn :> "conversations" diff --git a/services/galley/src/Galley/API/Public.hs b/services/galley/src/Galley/API/Public.hs index 242e401758d..ff8b8e6fb4f 100644 --- a/services/galley/src/Galley/API/Public.hs +++ b/services/galley/src/Galley/API/Public.hs @@ -92,6 +92,7 @@ servantSitemap = GalleyAPI.addMembersToConversationV2 = Update.addMembers, GalleyAPI.removeMemberUnqualified = Update.removeMemberUnqualified, GalleyAPI.removeMember = Update.removeMemberQualified, + GalleyAPI.updateConversationNameDeprecated = Update.updateLocalConversationName, GalleyAPI.updateConversationNameUnqualified = Update.updateLocalConversationName, GalleyAPI.updateConversationName = Update.updateConversationName, GalleyAPI.getTeamConversationRoles = Teams.getTeamConversationRoles, @@ -545,22 +546,6 @@ sitemap = do -- Conversation API --------------------------------------------------- - -- This endpoint can lead to the following events being sent: - -- - ConvRename event to members - put "/conversations/:cnv" (continue Update.updateConversationDeprecatedH) $ - zauthUserId - .&. zauthConnId - .&. capture "cnv" - .&. jsonRequest @Public.ConversationRename - document "PUT" "updateConversationName" $ do - summary "DEPRECATED! Please use updateConversationName instead!" - parameter Path "cnv" bytes' $ - description "Conversation ID" - body (ref Public.modelConversationUpdateName) $ - description "JSON body" - returns (ref Public.modelEvent) - errorResponse (Error.errorDescriptionToWai Error.convNotFound) - -- This endpoint can lead to the following events being sent: -- - MemberJoin event to members post "/conversations/:cnv/join" (continue Update.joinConversationByIdH) $ From ba246c34383caf0a0f102bc45a810e13eec8da84 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Mon, 6 Sep 2021 10:31:31 +0200 Subject: [PATCH 6/8] Update CHANGELOG --- CHANGELOG-draft.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG-draft.md b/CHANGELOG-draft.md index 644c159c3ca..8e7d3415be1 100644 --- a/CHANGELOG-draft.md +++ b/CHANGELOG-draft.md @@ -29,6 +29,8 @@ THIS FILE ACCUMULATES THE RELEASE NOTES FOR THE UPCOMING RELEASE. * Add `POST /conversations/list/v2` (#1703) * Deprecate `POST /list-conversations` (#1703) +* Add `PUT /conversations/:domain/:cnv/name` (#1737) +* Deprecate `PUT /conversations/:cnv/name` (#1737) ## Features From 8239b2c2ded95e9f03e26809b76684a7bfc2ad5e Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Wed, 8 Sep 2021 09:49:29 +0200 Subject: [PATCH 7/8] Revert hack to display helm test output The hack in #1700 does not actually seem to work in CI, and in fact it prevents log output from being displayed at all when helm test fails. The integration-test-logs.sh script is still around, and it can be used to display helm test output interactive when running tests manually in a terminal. --- hack/bin/integration-test.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hack/bin/integration-test.sh b/hack/bin/integration-test.sh index 03470d2115c..94feccde1a6 100755 --- a/hack/bin/integration-test.sh +++ b/hack/bin/integration-test.sh @@ -5,7 +5,5 @@ NAMESPACE=${NAMESPACE:-test-integration} echo "Running integration tests on wire-server" -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CHART=wire-server -helm test -n "${NAMESPACE}" "${NAMESPACE}-${CHART}" --timeout 600s | - "$DIR/integration-test-logs.sh" +helm test --logs -n "${NAMESPACE}" "${NAMESPACE}-${CHART}" --timeout 600s From b0bb104f44b5a31d484c26e523fa15ef9024ee32 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Wed, 8 Sep 2021 13:15:16 +0200 Subject: [PATCH 8/8] Assert on label on failure test --- services/galley/test/integration/API.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index 14fab9be2ee..2470983a019 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -2427,7 +2427,9 @@ putQualifiedConvRenameFailure = do qbob <- randomQualifiedUser let qconv = Qualified conv (qDomain qbob) putQualifiedConversationName (qUnqualified qbob) qconv "gossip" - !!! const 404 === statusCode + !!! do + const 404 === statusCode + const (Just "no-conversation") === fmap label . responseJsonUnsafe putQualifiedConvRenameOk :: TestM () putQualifiedConvRenameOk = do