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
2 changes: 2 additions & 0 deletions CHANGELOG-draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions hack/bin/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
101 changes: 76 additions & 25 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ())
Expand All @@ -111,22 +111,22 @@ 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"
:> ZUser
:> "conversations"
:> Capture "cnv" ConvId
:> "roles"
:> Get '[Servant.JSON] Public.ConversationRolesList,
:> Get '[Servant.JSON] ConversationRolesList,
listConversationIdsUnqualified ::
routes
:- Summary "[deprecated] Get all local conversation IDs."
Expand All @@ -148,16 +148,16 @@ 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."
:> Description "To retrieve the next page, a client must pass the paging_state returned by the previous page."
:> 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."
Expand Down Expand Up @@ -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)"
Expand All @@ -196,17 +196,17 @@ 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"
:> ZUser
:> "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 ::
Expand All @@ -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"
Expand All @@ -232,7 +232,7 @@ data Api routes = Api
:> ZUser
:> ZConn
:> "conversations"
:> ReqBody '[Servant.JSON] Public.NewConvUnmanaged
:> ReqBody '[Servant.JSON] NewConvUnmanaged
:> ConversationVerb,
createSelfConversation ::
routes
Expand All @@ -251,7 +251,7 @@ data Api routes = Api
:> ZConn
:> "conversations"
:> "one2one"
:> ReqBody '[Servant.JSON] Public.NewConvUnmanaged
:> ReqBody '[Servant.JSON] NewConvUnmanaged
:> ConversationVerb,
addMembersToConversationV2 ::
routes
Expand All @@ -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
Expand Down Expand Up @@ -296,6 +296,57 @@ data Api routes = Api
'[JSON]
RemoveFromConversationHTTPResponse
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 (deprecated)"
:> Description "Use `/conversations/:domain/:conv/name` instead."
:> 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 ::
Expand All @@ -307,7 +358,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"
Expand All @@ -316,7 +367,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"
Expand All @@ -326,7 +377,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"
Expand Down
35 changes: 3 additions & 32 deletions services/galley/src/Galley/API/Public.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ 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,
GalleyAPI.getTeamConversations = Teams.getTeamConversations,
GalleyAPI.getTeamConversation = Teams.getTeamConversation,
Expand Down Expand Up @@ -543,38 +546,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) $
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) $
Expand Down
Loading