-
Notifications
You must be signed in to change notification settings - Fork 334
Create remote 1-1 conversations #1825
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
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e05e96b
Extract function to create UserList
pcapriotti 56e330f
Add stub for remote 1-1 conversation creation
pcapriotti 8310966
Compute remote 1-1 conversation IDs
pcapriotti 2be6a6a
ensureConnected now takes a UserList
pcapriotti ae0bbd0
Make /conversations/one2one federation-aware
pcapriotti 6536bca
Remove create from UUID Version class
pcapriotti e5a417a
Introduce V5 UUIDs and use them for 1-1 conv
pcapriotti 92231a5
Servantify internal endpoint for connect conv
pcapriotti 59a6f75
Make recipient field of connect event qualified
pcapriotti 3428844
Extract function to create legacy connect conv
pcapriotti 42e1fe9
Add tests for the conversation ID algorithm
7c28551
write internal with stubs for data functions
cf54c8d
Implement a function for creating and updating a 1-1 remote conversation
14f2372
use schema-profunctor for json instances
smatting 03a1609
galley-types rename module to Intra
smatting 6fcdc7b
galley: remove "these" dep
smatting 99ce2e3
fix impossible example
smatting ba486dd
remove todo
smatting c237ef4
un-nameclash: one2OneConvId -> localOne2OneConvId
smatting b7c464e
remove warning suppression
smatting cf435c0
brig: add rpc function
smatting 62836c3
change api: alwyas return a conv id
smatting 60a6f79
Add tests for one2one conversation internal endpoint
smatting 3555df9
Test remote one2one conversation case
pcapriotti e4d2a14
Update golden tests after change in connect event
pcapriotti c27cc2d
Add CHANGELOG entry
pcapriotti b56d4fe
Remove incorrect comment
smatting File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add internal endpoint to insert or update a 1-1 conversation. This is to be used by brig when updating the status of a connection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| -- This file is part of the Wire Server implementation. | ||
| -- | ||
| -- Copyright (C) 2021 Wire Swiss GmbH <opensource@wire.com> | ||
| -- | ||
| -- This program is free software: you can redistribute it and/or modify it under | ||
| -- the terms of the GNU Affero General Public License as published by the Free | ||
| -- Software Foundation, either version 3 of the License, or (at your option) any | ||
| -- later version. | ||
| -- | ||
| -- This program is distributed in the hope that it will be useful, but WITHOUT | ||
| -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| -- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
| -- details. | ||
| -- | ||
| -- You should have received a copy of the GNU Affero General Public License along | ||
| -- with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| module Galley.Types.Conversations.Intra | ||
| ( DesiredMembership (..), | ||
| Actor (..), | ||
| UpsertOne2OneConversationRequest (..), | ||
| UpsertOne2OneConversationResponse (..), | ||
| ) | ||
| where | ||
|
|
||
| import qualified Data.Aeson as A | ||
| import Data.Aeson.Types (FromJSON, ToJSON) | ||
| import Data.Id (ConvId, UserId) | ||
| import Data.Qualified | ||
| import Data.Schema | ||
| import Imports | ||
|
|
||
| data DesiredMembership = Included | Excluded | ||
| deriving (Show, Eq, Generic) | ||
| deriving (FromJSON, ToJSON) via Schema DesiredMembership | ||
|
|
||
| instance ToSchema DesiredMembership where | ||
| schema = | ||
| enum @Text "DesiredMembership" $ | ||
| mconcat | ||
| [ element "included" Included, | ||
| element "excluded" Excluded | ||
| ] | ||
|
|
||
| data Actor = LocalActor | RemoteActor | ||
| deriving (Show, Eq, Generic) | ||
| deriving (FromJSON, ToJSON) via Schema Actor | ||
|
|
||
| instance ToSchema Actor where | ||
| schema = | ||
| enum @Text "Actor" $ | ||
| mconcat | ||
| [ element "local_actor" LocalActor, | ||
| element "remote_actor" RemoteActor | ||
| ] | ||
|
|
||
| data UpsertOne2OneConversationRequest = UpsertOne2OneConversationRequest | ||
| { uooLocalUser :: Local UserId, | ||
| uooRemoteUser :: Remote UserId, | ||
| uooActor :: Actor, | ||
| uooActorDesiredMembership :: DesiredMembership, | ||
| uooConvId :: Maybe (Qualified ConvId) | ||
| } | ||
| deriving (Show, Generic) | ||
| deriving (FromJSON, ToJSON) via Schema UpsertOne2OneConversationRequest | ||
|
|
||
| instance ToSchema UpsertOne2OneConversationRequest where | ||
| schema = | ||
| object "UpsertOne2OneConversationRequest" $ | ||
| UpsertOne2OneConversationRequest | ||
| <$> (qUntagged . uooLocalUser) .= field "local_user" (qTagUnsafe <$> schema) | ||
| <*> (qUntagged . uooRemoteUser) .= field "remote_user" (qTagUnsafe <$> schema) | ||
| <*> uooActor .= field "actor" schema | ||
| <*> uooActorDesiredMembership .= field "actor_desired_membership" schema | ||
| <*> uooConvId .= field "conversation_id" (optWithDefault A.Null schema) | ||
|
|
||
| newtype UpsertOne2OneConversationResponse = UpsertOne2OneConversationResponse | ||
| { -- | The Nothing value here indicated that there an impossible request was | ||
| -- received, e.g., a remote actor for a remotely owned connect conversation | ||
| uuorConvId :: Qualified ConvId | ||
| } | ||
| deriving (Show, Generic) | ||
| deriving (FromJSON, ToJSON) via Schema UpsertOne2OneConversationResponse | ||
|
|
||
| instance ToSchema UpsertOne2OneConversationResponse where | ||
| schema = | ||
| object "UpsertOne2OneConversationResponse" $ | ||
| UpsertOne2OneConversationResponse | ||
| <$> uuorConvId .= field "conversation_id" schema | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.