Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
62308a9
Make conversation ID qualified in removing a member
Jul 27, 2021
4942588
Make the ID of the user to be removed from a conversation qualified
Jul 27, 2021
1c56c34
Simple renaming and refactoring towards qualified conv leaving
Jul 27, 2021
40a1c0e
Introduce signatures for two local functions
Jul 27, 2021
a8dafab
Migrate DELETE /conversations/:cnv/members/:usr to Servant
Jul 29, 2021
e596a18
HLS improvements
Jul 29, 2021
7961818
Fix compilation issues and remove an unused handler
Jul 29, 2021
d25481e
Renaming of unqualified conversation tests
Jul 29, 2021
a9a7c06
Introduce the main endpoint and a test for the local domain case only
Jul 30, 2021
b2393ab
Apply eta reduction suggested by HLS
Jul 30, 2021
2e99d3c
Add a federation gRPC endpoint and a stub handler
Jul 31, 2021
80a3a27
WIP: a test for removing members from a a non-existing conversation
Jul 31, 2021
77c1b48
Fix up response types and remove unfinished federation tests
Aug 2, 2021
688acd8
Unqualify the conversation ID
Aug 2, 2021
9bdf11b
Update a test for local conversations
Aug 2, 2021
ecd907a
Use ExceptT in removeMemberFromLocalConv
Aug 3, 2021
d20f409
Fix a compilation error after merging
Aug 3, 2021
732d35a
Minor polishing
Aug 3, 2021
c771759
Generalize a Galley integration test utility
Aug 3, 2021
1c4df7e
Function renaming to better reflect their purpose
Aug 3, 2021
b6c0294
Binding renaming to better reflect what it contains
Aug 3, 2021
3e8ccb3
Add a member removal utility function for remote backends
Aug 3, 2021
ef390f5
Notify remote backends of conversation members removed
Aug 3, 2021
53d8757
Add a HasCallStack constraint to an integration test utility
Aug 3, 2021
b8c6ea5
Update the changelog with the deprecated endpoint
Aug 4, 2021
c7d03a5
Introduce a conversation event type for removing qualified members
Aug 4, 2021
03ab66f
A conversation membership update can either add or remove users
Aug 5, 2021
3cfa613
Backwards compatibility: return the MemberLeave Event type
Aug 5, 2021
f643945
Add a federated test for a conversation membership update
Aug 6, 2021
cb7b4a8
Membership handler: pull out common parts from distinct cases
Aug 6, 2021
9bde3b0
Fix a couple of small documentation errors
Aug 6, 2021
7375e8e
There must be at least 1 member in a conversation membership update
Aug 6, 2021
00af6c7
Use the right backwards compatibility flag in an old endpoint handler
Aug 9, 2021
9ffcbab
Fix the usage of randomUser in federation tests
Aug 9, 2021
660b0e3
Update a federation test description
Aug 9, 2021
7d7b014
Update a comment next to the qualified endpoint for member removal
Aug 9, 2021
1c6e33f
Make two more errors explicit in the type of Update.removeMember
Aug 9, 2021
1a6dc9e
Minor documentation improvement and removing commented out code
Aug 9, 2021
0e5ba1b
Finish expressing the errors of Update.removeMember via its type
Aug 9, 2021
54b9a93
Remove unneeded class instances
Aug 10, 2021
41392c0
Remove an unused type constraint on a test utility
Aug 10, 2021
8e7a923
Add an integration test for removing a local user
Aug 10, 2021
d1c2412
Update the change log
Aug 11, 2021
e28f05d
Add documentation for the ConversationMembersAction type
Aug 11, 2021
2c4cba7
Fix the documentation of a module
Aug 11, 2021
a6610b0
Update the description of a federation test
Aug 11, 2021
fe1b8d8
Move the non-empty list with origin type to an appropriate module
Aug 11, 2021
beb67ea
Fix a typo
Aug 11, 2021
903a7ae
Make deprecatedSchema more general
Aug 11, 2021
3286b21
Make UserIdList take a list of qualified user IDs
Aug 11, 2021
9666ad7
Remove the MemberLeaveQualified conversation event type
Aug 12, 2021
5452f08
Remove the even backwards compatibility flag
Aug 12, 2021
4ff5dab
The removal endpoint takes a qualified conversation ID
Aug 12, 2021
4ef9639
Introduce several integration test utilities
Aug 13, 2021
0330e0b
Avoid repeating: use an integration test utility
Aug 13, 2021
12d553c
Add a currently failing test
Aug 13, 2021
db2c283
Update an endpoint comment
Aug 13, 2021
6aeb720
Add a Haddock for Update.removeMember
Aug 13, 2021
c484569
Make sure remote conversation members can't remove others
Aug 13, 2021
4b70097
Change a function input type so it is constrained in usage
Aug 13, 2021
8be7be0
Add documentation for a function's arguments
Aug 13, 2021
47d77f8
Generalize a few Galley member utilities
Aug 13, 2021
57fe56a
Further generalize conversation member utilities
Aug 13, 2021
be576e6
Make remover qualified in Update.removeMember
Aug 13, 2021
69e99a5
Add an endpoint: DELETE /federation/leave-conversation
Aug 17, 2021
50274dd
A minor readability improvement
Aug 17, 2021
d457eaa
Finish implementing the leaving of a remote conversation
Aug 17, 2021
81f59aa
Fix a typo in the documentation
Aug 17, 2021
599d877
Get rid of the QualifiedUserIdList type
Aug 17, 2021
b4d65db
Change a TODO into a FUTUREWORK
Aug 17, 2021
7702cab
Reuse a testing utility instead of writing it from scratch
Aug 17, 2021
b797480
Fix compile errors after rebase
akshaymankar Aug 19, 2021
e52807d
Ormolu
akshaymankar Aug 23, 2021
178abec
Fix the JSON instances for team events
Aug 23, 2021
1a94a46
Rename a field of the ConversationMemberUpdate record
Aug 23, 2021
87d5a28
Redo removing a leftover
Aug 23, 2021
4a0e383
Update services/galley/src/Galley/API/Util.hs
Aug 23, 2021
84178ff
Simplify responses for conversation member removal
Aug 24, 2021
71e0166
Get rid of a special case for leaving a conversation
Aug 24, 2021
87acd10
Use only POST and HTTP 200 in federation api for leaving conv
Aug 24, 2021
fb304df
Make swagger prettier for multiple qualified captures
Aug 24, 2021
31a2873
removeMembersFromLocalConv: Delete function
Aug 24, 2021
b2e7a7a
addToConversaion: Accept two simple lists
Aug 24, 2021
6dd82d1
Improve Haddock of a function
Aug 24, 2021
2cebe78
Use NonEmpty in ConversationMemberAction
Aug 24, 2021
58db4ec
Delete List1WithOrigin
Aug 24, 2021
475f088
Use unless to have less indentation
Aug 24, 2021
03dd46b
Simplify removeMemberFromLocalConv
Aug 24, 2021
187d2ca
Fix an integration test
Aug 24, 2021
7b7f984
Add a golden test for /federation/leave-conversation
Aug 24, 2021
f98e83b
Add a few golden tests for ConversationMemberUpdate
Aug 24, 2021
f03a73b
Create events for the leaving local user locally
akshaymankar Aug 25, 2021
88b3860
Remove stray comment
akshaymankar Aug 25, 2021
7efc6fd
Remove unnecessary Read instance
akshaymankar Aug 25, 2021
830039f
Render the qualified ids under "qualified_user_ids" for UserIdList
akshaymankar Aug 25, 2021
dac3221
Reduce number of golden tests for UserIdList
akshaymankar Aug 25, 2021
c28ad86
Refactor code to notify remotes of conversation changes
akshaymankar Aug 25, 2021
2738421
Refactor notifyRemoteAboutConvUpdate to only take ConvId
akshaymankar Aug 25, 2021
2ca51f3
Better comment
akshaymankar Aug 25, 2021
dfabf76
Remove redundant import
akshaymankar Aug 25, 2021
2568825
Better names for integration tests
akshaymankar Aug 25, 2021
1301700
Refactor tests to avoid levels of indentations
akshaymankar Aug 25, 2021
21ce56f
Merge branch 'develop' into mdimjasevic/mdimjasevic/fed-leave-remote-…
akshaymankar Aug 25, 2021
124f12d
WIP: Add test to delete a remote member
akshaymankar Aug 25, 2021
5911c88
Delete unnecessary function and Ormolu
akshaymankar Aug 26, 2021
b9f0e79
Remove unnecessary mocking
akshaymankar Aug 26, 2021
5b2ac84
Add assertions for the membership update
akshaymankar Aug 26, 2021
a5ac7b2
undo undid hlint
akshaymankar Aug 26, 2021
3f0b6c6
Remove unnecessary variable
akshaymankar Aug 26, 2021
e084cb5
Create conversation with qualified users using one call
akshaymankar Aug 26, 2021
3a5f0c1
Add test for trying to remove local user from remote conv
akshaymankar Aug 26, 2021
a4cc2a4
Avoid using Cql directly from fed integration tests
akshaymankar Aug 26, 2021
c72689c
WIP: Add test for /federation/leave-conversation
akshaymankar Aug 26, 2021
c605a86
Ormolu
akshaymankar Aug 26, 2021
aa0e7b9
Finish WIP for federated leave conversion endpoint
akshaymankar Aug 26, 2021
bbf3511
Cosmetic undo
akshaymankar Aug 26, 2021
05487b0
Undo making EDMemberLeave qualified
akshaymankar Aug 26, 2021
35b09a0
Make UserIdList unqualified so it can be used for team things
akshaymankar Aug 26, 2021
3780cc7
Fix compilation errors in brig tests
akshaymankar Aug 26, 2021
e1af680
Fix compile issues
akshaymankar Aug 26, 2021
bd5fd9f
Add e2e test, not tested locally
akshaymankar Aug 26, 2021
5d2f850
Merge branch 'develop' into mdimjasevic/mdimjasevic/fed-leave-remote-…
akshaymankar Aug 26, 2021
d3f3249
Ormolu
akshaymankar Aug 26, 2021
26627f2
Add E2E test for leaving a conversation
akshaymankar Aug 26, 2021
e8be744
Ormolu
akshaymankar Aug 26, 2021
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
7 changes: 7 additions & 0 deletions CHANGELOG-draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ THIS FILE ACCUMULATES THE RELEASE NOTES FOR THE UPCOMING RELEASE.

## API Changes

* Deprecate `DELETE /conversations/:cnv/members/:usr` (#1697)
* Add `DELETE /conversations/:cnv/members/:domain/:usr` (#1697)

## Features

## Bug fixes and other updates
Expand All @@ -40,14 +43,18 @@ THIS FILE ACCUMULATES THE RELEASE NOTES FOR THE UPCOMING RELEASE.

## Documentation

* Improve Swagger for `DELETE /conversations/:cnv/members/:usr` (#1697)

## Internal changes

* Integration test script now displays output interactively (#1700)
* Fixed a few issues with error response documentation in Swagger (#1707)
* Make mapping between (team) permissions and roles more lenient (#1711)
* The `DELETE /conversations/:cnv/members/:usr` endpoint rewritten to Servant (#1697)
* Remove leftover auto-connect internal endpoint and code (#1716)

## Federation changes

* Added client certificate support for server to server authentication (#1682)
* Implemented full server-to-server authentication (#1687)
* Add an endpoint for removing a qualified user from a local conversation (#1697)
2 changes: 1 addition & 1 deletion libs/api-client/src/Network/Wire/Client/API/Push.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import qualified System.Logger as Log
import Wire.API.Connection (UserConnection (..))
import Wire.API.Conversation.Member (MemberUpdate (..))
import Wire.API.Event.Conversation hiding (Event, EventType)
import Wire.API.User (Name (..), User (..), userEmail)
import Wire.API.User (Name (..), User (..), UserIdList (..), userEmail)

-------------------------------------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions libs/galley-types/src/Galley/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Galley.Types
EventType (..),
EventData (..),
UserIdList (..),
QualifiedUserIdList (..),
SimpleMember (..),
SimpleMembers (..),
MemberUpdateData (..),
Expand Down Expand Up @@ -85,6 +86,7 @@ import Wire.API.Conversation.Typing
import Wire.API.CustomBackend
import Wire.API.Event.Conversation
import Wire.API.Message
import Wire.API.User (UserIdList (..))
import Wire.API.User.Client

--------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions libs/types-common/src/Data/Qualified.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ partitionRemote remotes = Map.assocs $ partitionQualified (unTagged <$> remotes)
renderQualifiedId :: Qualified (Id a) -> Text
renderQualifiedId = renderQualified (cs . UUID.toString . toUUID)

deprecatedSchema :: Text -> ValueSchema NamedSwaggerDoc a -> ValueSchema SwaggerDoc a
deprecatedSchema new = (doc . description ?~ ("Deprecated, use " <> new)) . unnamed
deprecatedSchema :: S.HasDescription doc (Maybe Text) => Text -> ValueSchema doc a -> ValueSchema doc a
deprecatedSchema new = doc . description ?~ ("Deprecated, use " <> new)

qualifiedSchema ::
Text ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import Test.QuickCheck (Arbitrary)
import Wire.API.Arbitrary (GenericUniform (..))
import Wire.API.Federation.Client (FederationClientFailure, FederatorClient)
import qualified Wire.API.Federation.GRPC.Types as Proto
import Wire.API.Federation.Util.Aeson (CustomEncoded (..))
import Wire.API.Message (UserClients)
import Wire.API.User (UserProfile)
import Wire.API.User.Client (PubClient, UserClientPrekeyMap)
import Wire.API.User.Client.Prekey (ClientPrekey, PrekeyBundle)
import Wire.API.User.Search
import Wire.API.UserMap (UserMap)
import Wire.API.Util.Aeson (CustomEncoded (..))

newtype SearchRequest = SearchRequest {term :: Text}
deriving (Show, Eq, Generic, Typeable)
Expand Down
50 changes: 39 additions & 11 deletions libs/wire-api-federation/src/Wire/API/Federation/API/Galley.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2020 Wire Swiss GmbH <opensource@wire.com>
Expand All @@ -23,6 +21,7 @@ import Control.Monad.Except (MonadError (..))
import Data.Aeson (FromJSON, ToJSON)
import Data.Id (ClientId, ConvId, UserId)
import Data.Json.Util (Base64ByteString)
import Data.List.NonEmpty (NonEmpty)
import Data.Misc (Milliseconds)
import Data.Qualified (Qualified)
import Data.Time.Clock (UTCTime)
Expand All @@ -37,9 +36,10 @@ import Wire.API.Conversation.Role (RoleName)
import Wire.API.Federation.Client (FederationClientFailure, FederatorClient)
import Wire.API.Federation.Domain (OriginDomainHeader)
import qualified Wire.API.Federation.GRPC.Types as Proto
import Wire.API.Federation.Util.Aeson (CustomEncoded (..))
import Wire.API.Message (MessageNotSent, MessageSendingStatus, PostOtrResponse, Priority)
import Wire.API.Routes.Public.Galley.Responses (RemoveFromConversationError)
import Wire.API.User.Client (UserClientMap)
import Wire.API.Util.Aeson (CustomEncoded (..))

-- FUTUREWORK: data types, json instances, more endpoints. See
-- https://wearezeta.atlassian.net/wiki/spaces/CORE/pages/356090113/Federation+Galley+Conversation+API
Expand Down Expand Up @@ -68,6 +68,13 @@ data Api routes = Api
:> "update-conversation-memberships"
:> ReqBody '[JSON] ConversationMemberUpdate
:> Post '[JSON] (),
leaveConversation ::
routes
:- "federation"
:> "leave-conversation"
:> OriginDomainHeader
:> ReqBody '[JSON] LeaveConversationRequest
:> Post '[JSON] LeaveConversationResponse,
-- used to notify this backend that a new message has been posted to a
-- remote conversation
receiveMessage ::
Expand Down Expand Up @@ -129,6 +136,15 @@ data RegisterConversation = MkRegisterConversation
deriving stock (Eq, Show, Generic)
deriving (ToJSON, FromJSON) via (CustomEncoded RegisterConversation)

-- | A conversation membership update, as given by ' ConversationMemberUpdate',
-- can be either a member addition or removal.
data ConversationMembersAction
= ConversationMembersActionAdd (NonEmpty (Qualified UserId, RoleName))
| ConversationMembersActionRemove (NonEmpty (Qualified UserId))
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform ConversationMembersAction)
deriving (ToJSON, FromJSON) via (CustomEncoded ConversationMembersAction)

data ConversationMemberUpdate = ConversationMemberUpdate
{ cmuTime :: UTCTime,
cmuOrigUserId :: Qualified UserId,
Expand All @@ -138,19 +154,24 @@ data ConversationMemberUpdate = ConversationMemberUpdate
-- non-conversation owning backend to have an indexed mapping of
-- conversation to users.
cmuAlreadyPresentUsers :: [UserId],
-- | Users that got added to the conversation.
cmuUsersAdd :: [(Qualified UserId, RoleName)],
-- | Users that got removed from the conversation. This should probably be
-- Qualified, but as of now this is a stub.
--
-- FUTUREWORK: Implement this when supporting removal of remote conversation
-- members.
cmuUsersRemove :: [UserId]
-- | Users that got either added to or removed from the conversation.
cmuAction :: ConversationMembersAction
}
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform ConversationMemberUpdate)
deriving (ToJSON, FromJSON) via (CustomEncoded ConversationMemberUpdate)

data LeaveConversationRequest = LeaveConversationRequest
{ -- | The conversation is assumed to be owned by the target domain, which
-- allows us to protect against relay attacks
lcConvId :: ConvId,
-- | The leaver is assumed to be owned by the origin domain, which allows us
-- to protect against spoofing attacks
lcLeaver :: UserId
}
deriving stock (Generic, Eq, Show)
deriving (ToJSON, FromJSON) via (CustomEncoded LeaveConversationRequest)

-- Note: this is parametric in the conversation type to allow it to be used
-- both for conversations with a fixed known domain (e.g. as the argument of the
-- federation RPC), and for conversations with an arbitrary Qualified or Remote id
Expand Down Expand Up @@ -193,5 +214,12 @@ newtype MessageSendResponse = MessageSendResponse
MessageSendingStatus
)

newtype LeaveConversationResponse = LeaveConversationResponse
{leaveResponse :: Either RemoveFromConversationError ()}
deriving stock (Eq, Show)
deriving
(ToJSON, FromJSON)
via (Either (CustomEncoded RemoveFromConversationError) ())

clientRoutes :: (MonadError FederationClientFailure m, MonadIO m) => Api (AsClientT (FederatorClient 'Proto.Galley m))
clientRoutes = genericClient
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Data.Time
import Imports
import Test.QuickCheck (Arbitrary (arbitrary))
import qualified Test.QuickCheck as QC
import Wire.API.Federation.Util.Aeson (CustomEncoded (CustomEncoded))
import Wire.API.Util.Aeson (CustomEncoded (CustomEncoded))

data AnyEvent
= EventMemberJoin (ConversationEvent MemberJoin)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
-- 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 Test.Wire.API.Federation.Golden.ConversationMemberUpdate where

import Data.Domain (Domain (Domain))
import Data.Id (Id (Id), UserId)
import Data.List.NonEmpty (NonEmpty (..))
import Data.Qualified (Qualified (Qualified))
import qualified Data.UUID as UUID
import Imports
import Wire.API.Conversation.Role (roleNameWireAdmin, roleNameWireMember)
import Wire.API.Federation.API.Galley (ConversationMemberUpdate (..), ConversationMembersAction (..))

qAlice, qBob :: Qualified UserId
qAlice =
Qualified
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100004007")))
(Domain "golden.example.com")
qBob =
Qualified
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100005007")))
(Domain "golden2.example.com")

chad, dee :: UserId
chad = Id (fromJust (UUID.fromString "00000fff-0000-0000-0000-000100005007"))
dee = Id (fromJust (UUID.fromString "00000fff-0000-aaaa-0000-000100005007"))

testObject_ConversationMemberUpdate1 :: ConversationMemberUpdate
testObject_ConversationMemberUpdate1 =
ConversationMemberUpdate
{ cmuTime = read "1864-04-12 12:22:43.673 UTC",
cmuOrigUserId =
Qualified
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000007")))
(Domain "golden.example.com"),
cmuConvId =
Qualified
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000006")))
(Domain "golden2.example.com"),
cmuAlreadyPresentUsers = [],
cmuAction = ConversationMembersActionAdd ((qAlice, roleNameWireMember) :| [(qBob, roleNameWireAdmin)])
}

testObject_ConversationMemberUpdate2 :: ConversationMemberUpdate
testObject_ConversationMemberUpdate2 =
ConversationMemberUpdate
{ cmuTime = read "1864-04-12 12:22:43.673 UTC",
cmuOrigUserId =
Qualified
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000007")))
(Domain "golden.example.com"),
cmuConvId =
Qualified
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000006")))
(Domain "golden2.example.com"),
cmuAlreadyPresentUsers = [chad, dee],
cmuAction = ConversationMembersActionRemove (qAlice :| [qBob])
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,35 @@ module Test.Wire.API.Federation.Golden.GoldenSpec where

import Imports
import Test.Hspec
import qualified Test.Wire.API.Federation.Golden.ConversationMemberUpdate as ConversationMemberUpdate
import qualified Test.Wire.API.Federation.Golden.LeaveConversationRequest as LeaveConversationRequest
import qualified Test.Wire.API.Federation.Golden.LeaveConversationResponse as LeaveConversationResponse
import qualified Test.Wire.API.Federation.Golden.MessageSendResponse as MessageSendResponse
import Test.Wire.API.Federation.Golden.Runner (testObjects)

spec :: Spec
spec =
describe "Golden tests" $
describe "Golden tests" $ do
testObjects
[ (MessageSendResponse.testObject_MessageSendReponse1, "testObject_MessageSendReponse1.json"),
(MessageSendResponse.testObject_MessageSendReponse2, "testObject_MessageSendReponse2.json"),
(MessageSendResponse.testObject_MessageSendReponse3, "testObject_MessageSendReponse3.json"),
(MessageSendResponse.testObject_MessageSendReponse4, "testObject_MessageSendReponse4.json"),
(MessageSendResponse.testObject_MessageSendReponse5, "testObject_MessageSendReponse5.json")
]
testObjects [(LeaveConversationRequest.testObject_LeaveConversationRequest1, "testObject_LeaveConversationRequest1.json")]
testObjects
[ (ConversationMemberUpdate.testObject_ConversationMemberUpdate1, "testObject_ConversationMemberUpdate1.json"),
(ConversationMemberUpdate.testObject_ConversationMemberUpdate2, "testObject_ConversationMemberUpdate2.json")
]
testObjects
[ (LeaveConversationResponse.testObject_LeaveConversationResponse1, "testObject_LeaveConversationResponse1.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse2, "testObject_LeaveConversationResponse2.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse3, "testObject_LeaveConversationResponse3.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse4, "testObject_LeaveConversationResponse4.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse5, "testObject_LeaveConversationResponse5.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse6, "testObject_LeaveConversationResponse6.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse7, "testObject_LeaveConversationResponse7.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse8, "testObject_LeaveConversationResponse8.json"),
(LeaveConversationResponse.testObject_LeaveConversationResponse9, "testObject_LeaveConversationResponse9.json")
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- 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 Test.Wire.API.Federation.Golden.LeaveConversationRequest where

import Data.Id (Id (Id))
import Data.Maybe (fromJust)
import qualified Data.UUID as UUID
import Wire.API.Federation.API.Galley (LeaveConversationRequest (LeaveConversationRequest))

testObject_LeaveConversationRequest1 :: LeaveConversationRequest
testObject_LeaveConversationRequest1 =
LeaveConversationRequest
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000002")))
(Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001")))
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Test.Wire.API.Federation.Golden.LeaveConversationResponse where

import Imports
import Wire.API.Federation.API.Galley (LeaveConversationResponse (LeaveConversationResponse))
import Wire.API.Routes.Public.Galley.Responses (RemoveFromConversationError (..))

testObject_LeaveConversationResponse1 :: LeaveConversationResponse
testObject_LeaveConversationResponse1 = LeaveConversationResponse $ Right ()

testObject_LeaveConversationResponse2 :: LeaveConversationResponse
testObject_LeaveConversationResponse2 = LeaveConversationResponse $ Left RemoveFromConversationErrorRemovalNotAllowed

testObject_LeaveConversationResponse3 :: LeaveConversationResponse
testObject_LeaveConversationResponse3 = LeaveConversationResponse $ Left RemoveFromConversationErrorManagedConvNotAllowed

testObject_LeaveConversationResponse4 :: LeaveConversationResponse
testObject_LeaveConversationResponse4 = LeaveConversationResponse $ Left RemoveFromConversationErrorNotFound

testObject_LeaveConversationResponse5 :: LeaveConversationResponse
testObject_LeaveConversationResponse5 = LeaveConversationResponse $ Left RemoveFromConversationErrorCustomRolesNotSupported

testObject_LeaveConversationResponse6 :: LeaveConversationResponse
testObject_LeaveConversationResponse6 = LeaveConversationResponse $ Left RemoveFromConversationErrorSelfConv

testObject_LeaveConversationResponse7 :: LeaveConversationResponse
testObject_LeaveConversationResponse7 = LeaveConversationResponse $ Left RemoveFromConversationErrorOne2OneConv

testObject_LeaveConversationResponse8 :: LeaveConversationResponse
testObject_LeaveConversationResponse8 = LeaveConversationResponse $ Left RemoveFromConversationErrorConnectConv

testObject_LeaveConversationResponse9 :: LeaveConversationResponse
testObject_LeaveConversationResponse9 = LeaveConversationResponse $ Left RemoveFromConversationErrorUnchanged
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"orig_user_id": {
"domain": "golden.example.com",
"id": "00000000-0000-0000-0000-000100000007"
},
"already_present_users": [],
"time": "1864-04-12T12:22:43.673Z",
"action": {
"tag": "ConversationMembersActionAdd",
"contents": [
[
{
"domain": "golden.example.com",
"id": "00000000-0000-0000-0000-000100004007"
},
"wire_member"
],
[
{
"domain": "golden2.example.com",
"id": "00000000-0000-0000-0000-000100005007"
},
"wire_admin"
]
]
},
"conv_id": {
"domain": "golden2.example.com",
"id": "00000000-0000-0000-0000-000100000006"
}
}
Loading