Skip to content

Commit

Permalink
Remove Global Team Conversations (#2916)
Browse files Browse the repository at this point in the history
* Revert "[FS-1267] Patch issue with initial commit bundle throwing a global team conversation error (#2887)"

This reverts commit 1cc2bd2.

* Revert "Commented out GTC for release. (#2879)"

This reverts commit 49da310.

* Revert "Improve global team conversation handling and self conversation creation error. (#2862)"

This reverts commit 381bf7b.

* Revert "[FS-926] Create new conversation type for global team conversation (#2753)"

This reverts commit c4c9ea2.
  • Loading branch information
smatting committed Dec 9, 2022
1 parent 719e259 commit 090e762
Show file tree
Hide file tree
Showing 46 changed files with 265 additions and 1,033 deletions.
10 changes: 0 additions & 10 deletions libs/bilge/src/Bilge/Assert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module Bilge.Assert
(===),
(=/=),
(=~=),
(=/~=),
assertResponse,
assertTrue,
assertTrue_,
Expand Down Expand Up @@ -142,15 +141,6 @@ f =/= g = Assertions $ tell [\r -> test " === " (/=) (f r) (g r)]
Assertions ()
f =~= g = Assertions $ tell [\r -> test " not in " contains (f r) (g r)]

-- | Tests the assertion that the left-hand side is **not** contained in the right-hand side.
-- If it is, actual values will be printed.
(=/~=) ::
(HasCallStack, Show a, Contains a) =>
(Response (Maybe Lazy.ByteString) -> a) ->
(Response (Maybe Lazy.ByteString) -> a) ->
Assertions ()
f =/~= g = Assertions $ tell [\r -> test " in " ((not .) . contains) (f r) (g r)]

-- | Most generic assertion on a request. If the test function evaluates to
-- @(Just msg)@ then the assertion fails with the error message @msg@.
assertResponse :: HasCallStack => (Response (Maybe Lazy.ByteString) -> Maybe String) -> Assertions ()
Expand Down
19 changes: 5 additions & 14 deletions libs/wire-api/src/Wire/API/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module Wire.API.Conversation
ConversationMetadata (..),
defConversationMetadata,
Conversation (..),
conversationMetadataObjectSchema,
cnvType,
cnvCreator,
cnvAccess,
Expand Down Expand Up @@ -103,7 +102,7 @@ import Data.Aeson (FromJSON (..), ToJSON (..))
import qualified Data.Aeson as A
import qualified Data.ByteString.Lazy as LBS
import Data.Id
import Data.List.Extra (disjointOrd, enumerate)
import Data.List.Extra (disjointOrd)
import Data.List.NonEmpty (NonEmpty)
import Data.List1
import Data.Misc
Expand Down Expand Up @@ -466,10 +465,6 @@ data Access
LinkAccess
| -- | User can join knowing [changeable/revokable] code
CodeAccess
| -- | In MLS the user can join the global team conversation with their
-- | clients via an external commit, thereby inviting their own clients to
-- | join.
SelfInviteAccess
deriving stock (Eq, Ord, Bounded, Enum, Show, Generic)
deriving (Arbitrary) via (GenericUniform Access)
deriving (ToJSON, FromJSON, S.ToSchema) via Schema Access
Expand All @@ -482,8 +477,7 @@ instance ToSchema Access where
[ element "private" PrivateAccess,
element "invite" InviteAccess,
element "link" LinkAccess,
element "code" CodeAccess,
element "self_invite" SelfInviteAccess
element "code" CodeAccess
]

typeAccess :: Doc.DataType
Expand Down Expand Up @@ -531,7 +525,6 @@ defRole = activatedAccessRole

maybeRole :: ConvType -> Maybe (Set AccessRole) -> Set AccessRole
maybeRole SelfConv _ = privateAccessRole
maybeRole GlobalTeamConv _ = teamAccessRole
maybeRole ConnectConv _ = privateAccessRole
maybeRole One2OneConv _ = privateAccessRole
maybeRole RegularConv Nothing = defRole
Expand Down Expand Up @@ -617,8 +610,7 @@ data ConvType
| SelfConv
| One2OneConv
| ConnectConv
| GlobalTeamConv
deriving stock (Eq, Show, Generic, Enum, Bounded)
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform ConvType)
deriving (FromJSON, ToJSON, S.ToSchema) via Schema ConvType

Expand All @@ -629,12 +621,11 @@ instance ToSchema ConvType where
[ element 0 RegularConv,
element 1 SelfConv,
element 2 One2OneConv,
element 3 ConnectConv,
element 4 GlobalTeamConv
element 3 ConnectConv
]

typeConversationType :: Doc.DataType
typeConversationType = Doc.int32 $ Doc.enum $ fromIntegral . fromEnum <$> enumerate @ConvType
typeConversationType = Doc.int32 $ Doc.enum [0, 1, 2, 3]

-- | Define whether receipts should be sent in the given conversation
-- This datatype is defined as an int32 but the Backend does not
Expand Down
5 changes: 0 additions & 5 deletions libs/wire-api/src/Wire/API/Conversation/Action.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import Wire.Arbitrary (Arbitrary (..))
-- individual effects per conversation action. See 'HasConversationActionEffects'.
type family ConversationAction (tag :: ConversationActionTag) :: * where
ConversationAction 'ConversationJoinTag = ConversationJoin
ConversationAction 'ConversationSelfInviteTag = ConvId
ConversationAction 'ConversationLeaveTag = ()
ConversationAction 'ConversationMemberUpdateTag = ConversationMemberUpdate
ConversationAction 'ConversationDeleteTag = ()
Expand Down Expand Up @@ -104,7 +103,6 @@ conversationActionSchema SConversationRenameTag = schema
conversationActionSchema SConversationMessageTimerUpdateTag = schema
conversationActionSchema SConversationReceiptModeUpdateTag = schema
conversationActionSchema SConversationAccessDataTag = schema
conversationActionSchema SConversationSelfInviteTag = schema

instance FromJSON SomeConversationAction where
parseJSON = A.withObject "SomeConversationAction" $ \ob -> do
Expand Down Expand Up @@ -152,9 +150,6 @@ conversationActionToEvent tag now quid qcnv action =
SConversationJoinTag ->
let ConversationJoin newMembers role = action
in EdMembersJoin $ SimpleMembers (map (`SimpleMember` role) (toList newMembers))
SConversationSelfInviteTag ->
-- this event will not be sent anyway so this is a dummy event
EdMembersJoin $ SimpleMembers []
SConversationLeaveTag ->
EdMembersLeave (QualifiedUserIdList [quid])
SConversationRemoveMembersTag ->
Expand Down
2 changes: 0 additions & 2 deletions libs/wire-api/src/Wire/API/Conversation/Action/Tag.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import Wire.Arbitrary (Arbitrary (..))

data ConversationActionTag
= ConversationJoinTag
| ConversationSelfInviteTag
| ConversationLeaveTag
| ConversationRemoveMembersTag
| ConversationMemberUpdateTag
Expand All @@ -49,7 +48,6 @@ instance ToSchema ConversationActionTag where
enum @Text "ConversationActionTag" $
mconcat
[ element "ConversationJoinTag" ConversationJoinTag,
element "ConversationSelfInviteTag" ConversationSelfInviteTag,
element "ConversationLeaveTag" ConversationLeaveTag,
element "ConversationRemoveMembersTag" ConversationRemoveMembersTag,
element "ConversationMemberUpdateTag" ConversationMemberUpdateTag,
Expand Down
1 change: 0 additions & 1 deletion libs/wire-api/src/Wire/API/Conversation/Protocol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module Wire.API.Conversation.Protocol
_ProtocolMLS,
_ProtocolProteus,
protocolSchema,
mlsDataSchema,
ConversationMLSData (..),
)
where
Expand Down
1 change: 0 additions & 1 deletion libs/wire-api/src/Wire/API/Conversation/Role.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module Wire.API.Conversation.Role
wireConvRoleNames,
roleNameWireAdmin,
roleNameWireMember,
roleToRoleName,

-- * Action
Action (..),
Expand Down
3 changes: 0 additions & 3 deletions libs/wire-api/src/Wire/API/Error/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ data GalleyError
| MLSWelcomeMismatch
| MLSMissingGroupInfo
| MLSMissingSenderClient
| MLSUnexpectedSenderClient
| --
NoBindingTeamMembers
| NoBindingTeam
Expand Down Expand Up @@ -212,8 +211,6 @@ type instance MapError 'MLSGroupConversationMismatch = 'StaticError 400 "mls-gro

type instance MapError 'MLSClientSenderUserMismatch = 'StaticError 400 "mls-client-sender-user-mismatch" "User ID resolved from Client ID does not match message's sender user ID"

type instance MapError 'MLSUnexpectedSenderClient = 'StaticError 422 "mls-unexpected-sender-client-found" "Unexpected creator client set. This is a newly created conversation and it expected exactly one client."

type instance MapError 'MLSWelcomeMismatch = 'StaticError 400 "mls-welcome-mismatch" "The list of targets of a welcome message does not match the list of new clients in a group"

type instance MapError 'MLSMissingGroupInfo = 'StaticError 404 "mls-missing-group-info" "The conversation has no group information"
Expand Down
63 changes: 0 additions & 63 deletions libs/wire-api/src/Wire/API/MLS/GlobalTeamConversation.hs

This file was deleted.

12 changes: 0 additions & 12 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,6 @@ type ConversationAPI =
:> QualifiedCapture "cnv" ConvId
:> Get '[Servant.JSON] Conversation
)
-- :<|> Named
-- "get-global-team-conversation"
-- ( Summary "Get the global conversation for a given team ID"
-- :> CanThrow 'ConvNotFound
-- :> CanThrow 'NotATeamMember
-- :> ZLocalUser
-- :> "teams"
-- :> Capture "tid" TeamId
-- :> "conversations"
-- :> "global"
-- :> Get '[Servant.JSON] GlobalTeamConversation
-- )
:<|> Named
"get-conversation-roles"
( Summary "Get existing roles available for the given conversation"
Expand Down
3 changes: 0 additions & 3 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/MLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ type MLSMessagingAPI =
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow 'MLSUnexpectedSenderClient
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSMissingSenderClient
Expand Down Expand Up @@ -92,7 +91,6 @@ type MLSMessagingAPI =
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow 'MLSUnexpectedSenderClient
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSMissingSenderClient
Expand Down Expand Up @@ -122,7 +120,6 @@ type MLSMessagingAPI =
:> CanThrow 'MLSStaleMessage
:> CanThrow 'MLSUnsupportedMessage
:> CanThrow 'MLSUnsupportedProposal
:> CanThrow 'MLSUnexpectedSenderClient
:> CanThrow 'MLSClientSenderUserMismatch
:> CanThrow 'MLSGroupConversationMismatch
:> CanThrow 'MLSMissingSenderClient
Expand Down
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/Routes/Public/Galley/Team.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type TeamAPI =
"create-non-binding-team"
( Summary "Create a new non binding team"
-- FUTUREWORK: deprecated in https://github.com/wireapp/wire-server/pull/2607
:> ZLocalUser
:> ZUser
:> ZConn
:> CanThrow 'NotConnected
:> CanThrow 'UserBindingExists
Expand Down
1 change: 0 additions & 1 deletion libs/wire-api/wire-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ library
Wire.API.MLS.Credential
Wire.API.MLS.Epoch
Wire.API.MLS.Extension
Wire.API.MLS.GlobalTeamConversation
Wire.API.MLS.Group
Wire.API.MLS.GroupInfoBundle
Wire.API.MLS.KeyPackage
Expand Down
4 changes: 2 additions & 2 deletions nix/pkgs/mls-test-cli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ rustPlatform.buildRustPackage rec {
src = fetchFromGitHub {
owner = "wireapp";
repo = "mls-test-cli";
sha256 = "sha256-FjgAcYdUr/ZWdQxbck2UEG6NEEQLuz0S4a55hrAxUs4=";
rev = "82fc148964ef5baa92a90d086fdc61adaa2b5dbf";
sha256 = "sha256-/XQ/9oQTPkRqgMzDGRm+Oh9jgkdeDM1vRJ6/wEf2+bY=";
rev = "c6f80be2839ac1ed2894e96044541d1c3cf6ecdf";
};
doCheck = false;
cargoSha256 = "sha256-AlZrxa7f5JwxxrzFBgeFSaYU6QttsUpfLYfq1HzsdbE=";
Expand Down
3 changes: 0 additions & 3 deletions services/brig/src/Brig/RPC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ x3 = limitRetries 3 <> exponentialBackoff 100000
zUser :: UserId -> Request -> Request
zUser = header "Z-User" . toByteString'

zClient :: ClientId -> Request -> Request
zClient = header "Z-Client" . toByteString'

remote :: ByteString -> Msg -> Msg
remote = field "remote"

Expand Down
14 changes: 1 addition & 13 deletions services/brig/test/integration/API/Provider.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,19 +1378,7 @@ createConvWithAccessRoles ars g u us =
. contentJson
. body (RequestBodyLBS (encode conv))
where
conv =
NewConv
us
[]
Nothing
Set.empty
ars
Nothing
Nothing
Nothing
roleNameWireAdmin
ProtocolProteusTag
Nothing
conv = NewConv us [] Nothing Set.empty ars Nothing Nothing Nothing roleNameWireAdmin ProtocolProteusTag Nothing

postMessage ::
Galley ->
Expand Down
31 changes: 30 additions & 1 deletion services/brig/test/integration/Federation/Util.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE PartialTypeSignatures #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}

-- This file is part of the Wire Server implementation.
--
Expand All @@ -22,19 +23,47 @@
module Federation.Util where

import Bilge
import Bilge.Assert ((!!!), (===))
import Bilge.Assert ((!!!), (<!!), (===))
import qualified Brig.Options as Opt
import qualified Control.Concurrent.Async as Async
import Control.Exception (finally, throwIO)
import Control.Lens ((.~), (?~), (^.))
import Control.Monad.Catch (MonadCatch, MonadThrow, bracket, try)
import Control.Monad.Trans.Except
import Control.Retry
import Data.Aeson (FromJSON, Value, decode, (.=))
import qualified Data.Aeson as Aeson
import Data.ByteString.Conversion (toByteString')
import Data.Domain (Domain (Domain))
import Data.Handle (fromHandle)
import Data.Id
import qualified Data.Map.Strict as Map
import Data.Qualified (Qualified (..))
import Data.String.Conversions (cs)
import qualified Data.Text as Text
import qualified Database.Bloodhound as ES
import qualified Federator.MockServer as Mock
import Foreign.C.Error (Errno (..), eCONNREFUSED)
import GHC.IO.Exception (IOException (ioe_errno))
import Imports
import qualified Network.HTTP.Client as HTTP
import Network.HTTP.Media
import Network.Socket
import Network.Wai.Handler.Warp (Port)
import Network.Wai.Test (Session)
import qualified Network.Wai.Test as WaiTest
import Test.QuickCheck (Arbitrary (arbitrary), generate)
import Test.Tasty
import Test.Tasty.HUnit
import Text.RawString.QQ (r)
import UnliftIO (Concurrently (..), runConcurrently)
import Util
import Util.Options (Endpoint (Endpoint))
import Wire.API.Connection
import Wire.API.Conversation (Conversation (cnvMembers))
import Wire.API.Conversation.Member (OtherMember (OtherMember), cmOthers)
import Wire.API.Conversation.Role (roleNameWireAdmin)
import Wire.API.Team.Feature (FeatureStatus (..))
import Wire.API.User
import Wire.API.User.Client
import Wire.API.User.Client.Prekey
Expand Down
Loading

0 comments on commit 090e762

Please sign in to comment.