Skip to content
Closed
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: 1 addition & 1 deletion libs/wire-api/src/Wire/API/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,11 @@ 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
maybeRole RegularConv (Just r) = r
maybeRole GlobalTeamConv _ = teamAccessRole

data AccessRole
= TeamMemberAccessRole
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
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
31 changes: 3 additions & 28 deletions services/galley/src/Galley/API/Action.hs
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,8 @@ ensureAllowed tag loc action conv origUser = do
-- not a team conv, so one of the other access roles has to allow this.
when (Set.null $ cupAccessRoles action Set.\\ Set.fromList [TeamMemberAccessRole]) $
throwS @'InvalidTargetAccess
SConversationSelfInviteTag ->
unless
(convType conv == GlobalTeamConv)
$ throwS @'InvalidOperation
SConversationLeaveTag ->
when (convType conv == GlobalTeamConv) $
throwS @'InvalidOperation
SConversationSelfInviteTag -> pure ()
SConversationLeaveTag -> pure ()
_ -> pure ()

-- | Returns additional members that resulted from the action (e.g. ConversationJoin)
Expand Down Expand Up @@ -634,10 +629,7 @@ updateLocalConversationUnchecked lconv qusr con action = do
conv = tUnqualified lconv

-- retrieve member
self <-
if (cnvmType . convMetadata . tUnqualified $ lconv) == GlobalTeamConv
then pure $ Left $ localMemberFromUser (qUnqualified qusr)
else noteS @'ConvNotFound $ getConvMember lconv conv qusr
self <- noteS @'ConvNotFound $ getConvMember lconv conv qusr

-- perform checks
ensureConversationActionAllowed (sing @tag) lcnv action conv self
Expand All @@ -657,23 +649,6 @@ updateLocalConversationUnchecked lconv qusr con action = do
-- --------------------------------------------------------------------------------
-- -- Utilities

localMemberFromUser :: UserId -> LocalMember
localMemberFromUser uid =
LocalMember
{ lmId = uid,
lmStatus =
MemberStatus
{ msOtrMutedStatus = Nothing,
msOtrMutedRef = Nothing,
msOtrArchived = False,
msOtrArchivedRef = Nothing,
msHidden = False,
msHiddenRef = Nothing
},
lmService = Nothing,
lmConvRoleName = roleToRoleName convRoleWireMember
}

ensureConversationActionAllowed ::
forall tag mem x r.
( IsConvMember mem,
Expand Down
1 change: 0 additions & 1 deletion services/galley/src/Galley/API/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ rmUser lusr conn = do
deleteMembers (Data.convId c) (UserList [tUnqualified lusr] [])
for_ (bucketRemote (fmap rmId (Data.convRemoteMembers c))) $ notifyRemoteMembers now qUser (Data.convId c)
pure Nothing

pp <- for cc $ \c -> case Data.convType c of
SelfConv -> pure Nothing
One2OneConv -> deleteMembers (Data.convId c) (UserList [tUnqualified lusr] []) $> Nothing
Expand Down
19 changes: 0 additions & 19 deletions services/galley/src/Galley/API/MLS/Message.hs
Original file line number Diff line number Diff line change
Expand Up @@ -866,25 +866,6 @@ processInternalCommit qusr senderClient con lconv mlsMeta cm epoch action sender
-- this is a newly created conversation, and it should contain exactly one
-- client (the creator)
throwS @'MLSUnexpectedSenderClient
(Left _, GlobalTeamConv, []) -> do
creatorClient <- noteS @'MLSMissingSenderClient senderClient
creatorRef <-
maybe
(pure senderRef)
( note (mlsProtocolError "Could not compute key package ref")
. kpRef'
. upLeaf
)
$ cPath commit
-- add user to global conv as a member as well
lusr <- qualifyLocal (qUnqualified qusr)
void $ createMember (convId <$> lconv) lusr
addMLSClients
(cnvmlsGroupId mlsMeta)
qusr
(Set.singleton (creatorClient, creatorRef))
(Left _, GlobalTeamConv, _) ->
throwS @'MLSUnexpectedSenderClient
(Left lm, _, [(qu, (creatorClient, _))])
| qu == qUntagged (qualifyAs lconv (lmId lm)) -> do
-- use update path as sender reference and if not existing fall back to sender
Expand Down
36 changes: 1 addition & 35 deletions services/galley/src/Galley/API/MLS/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import Galley.Effects
import Galley.Effects.ConversationStore
import Galley.Effects.MemberStore
import Galley.Effects.ProposalStore
import Galley.Types.Conversations.Members
import Imports
import Polysemy
import Polysemy.TinyLog (TinyLog)
Expand All @@ -36,7 +35,6 @@ import Wire.API.Conversation hiding (Conversation)
import Wire.API.Conversation.Protocol
import Wire.API.Error
import Wire.API.Error.Galley
import Wire.API.MLS.GlobalTeamConversation
import Wire.API.MLS.KeyPackage
import Wire.API.MLS.Proposal
import Wire.API.MLS.Serialisation
Expand All @@ -52,13 +50,7 @@ getLocalConvForUser ::
Local ConvId ->
Sem r Data.Conversation
getLocalConvForUser qusr lcnv = do
gtc <- getGlobalTeamConversationById lcnv
conv <- case gtc of
Just conv -> do
localMembers <- getLocalMembers (qUnqualified . gtcId $ conv)
pure $ gtcToConv conv (qUnqualified qusr) localMembers
Nothing -> do
getConversation (tUnqualified lcnv) >>= noteS @'ConvNotFound
conv <- getConversation (tUnqualified lcnv) >>= noteS @'ConvNotFound

-- check that sender is part of conversation
isMember' <-
Expand Down Expand Up @@ -90,29 +82,3 @@ getPendingBackendRemoveProposals gid epoch = do
TinyLog.warn $ Log.msg ("found pending proposal without origin, ignoring" :: ByteString)
pure Nothing
)

gtcToConv ::
GlobalTeamConversation ->
UserId ->
[LocalMember] ->
Conversation
gtcToConv gtc usr lm =
let mlsData = gtcMlsMetadata gtc
in Conversation
{ convId = qUnqualified $ gtcId gtc,
convLocalMembers = lm,
convRemoteMembers = mempty,
convDeleted = False,
convMetadata =
ConversationMetadata
{ cnvmType = GlobalTeamConv,
cnvmCreator = usr,
cnvmAccess = [SelfInviteAccess],
cnvmAccessRoles = mempty,
cnvmName = Just $ gtcName gtc,
cnvmTeam = Just $ gtcTeam gtc,
cnvmMessageTimer = Nothing,
cnvmReceiptMode = Nothing
},
convProtocol = ProtocolMLS mlsData
}
1 change: 0 additions & 1 deletion services/galley/src/Galley/API/Public/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ conversationAPI =
mkNamedAPI @"get-unqualified-conversation" getUnqualifiedConversation
<@> mkNamedAPI @"get-unqualified-conversation-legalhold-alias" getUnqualifiedConversation
<@> mkNamedAPI @"get-conversation" getConversation
-- <@> mkNamedAPI @"get-global-team-conversation" getGlobalTeamConversation
<@> mkNamedAPI @"get-conversation-roles" getConversationRoles
<@> mkNamedAPI @"get-group-info" getGroupInfo
<@> mkNamedAPI @"list-conversation-ids-unqualified" conversationIdsPageFromUnqualified
Expand Down
29 changes: 0 additions & 29 deletions services/galley/src/Galley/API/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module Galley.API.Query
( getBotConversationH,
getUnqualifiedConversation,
getConversation,
getGlobalTeamConversation,
getConversationRoles,
conversationIdsPageFromUnqualified,
conversationIdsPageFromV2,
Expand Down Expand Up @@ -53,7 +52,6 @@ import Data.Proxy
import Data.Qualified
import Data.Range
import qualified Data.Set as Set
import Data.Tagged
import Galley.API.Error
import Galley.API.MLS.Keys
import Galley.API.MLS.Types
Expand All @@ -69,7 +67,6 @@ import qualified Galley.Effects.ListItems as E
import qualified Galley.Effects.MemberStore as E
import Galley.Effects.TeamFeatureStore (FeaturePersistentConstraint)
import qualified Galley.Effects.TeamFeatureStore as TeamFeatures
import qualified Galley.Effects.TeamStore as E
import Galley.Env
import Galley.Options
import Galley.Types.Conversations.Members
Expand All @@ -94,7 +91,6 @@ import Wire.API.Error.Galley
import Wire.API.Federation.API
import Wire.API.Federation.API.Galley
import Wire.API.Federation.Error
import qualified Wire.API.MLS.GlobalTeamConversation as Public
import qualified Wire.API.Provider.Bot as Public
import qualified Wire.API.Routes.MultiTablePaging as Public
import Wire.API.Team.Feature as Public hiding (setStatus)
Expand Down Expand Up @@ -146,25 +142,6 @@ getUnqualifiedConversation lusr cnv = do
c <- getConversationAndCheckMembership (tUnqualified lusr) (qualifyAs lusr cnv)
Mapping.conversationView lusr c

getGlobalTeamConversation ::
Members
'[ ConversationStore,
ErrorS 'NotATeamMember,
MemberStore,
TeamStore
]
r =>
Local UserId ->
TeamId ->
Sem r Public.GlobalTeamConversation
getGlobalTeamConversation lusr tid = do
let ltid = qualifyAs lusr tid
void $ noteS @'NotATeamMember =<< E.getTeamMember tid (tUnqualified lusr)
E.getGlobalTeamConversation ltid >>= \case
Nothing ->
E.createGlobalTeamConversation (qualifyAs lusr tid)
Just conv -> pure conv

getConversation ::
forall r.
Members
Expand Down Expand Up @@ -316,12 +293,6 @@ conversationIdsPageFromUnqualified ::
Maybe (Range 1 1000 Int32) ->
Sem r (Public.ConversationList ConvId)
conversationIdsPageFromUnqualified lusr start msize = do
void $
E.getUserTeams (tUnqualified lusr) >>= \tids ->
runError @InternalError $
runError @(Tagged 'NotATeamMember ())
(for_ tids $ \tid -> getGlobalTeamConversation lusr tid)

let size = fromMaybe (toRange (Proxy @1000)) msize
ids <- E.listItems (tUnqualified lusr) start size
pure $
Expand Down
11 changes: 3 additions & 8 deletions services/galley/src/Galley/API/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import Data.Singletons
import qualified Data.Text as T
import Data.Time
import Galley.API.Error
import Galley.API.MLS.Util
import Galley.API.Mapping
import qualified Galley.Data.Conversation as Data
import Galley.Data.Services (BotMember, newBotMember)
Expand Down Expand Up @@ -193,7 +192,7 @@ ensureActionAllowed action self = case isActionAllowed (fromSing action) (convMe
ensureGroupConversation :: Member (ErrorS 'InvalidOperation) r => Data.Conversation -> Sem r ()
ensureGroupConversation conv = do
let ty = Data.convType conv
unless (ty `elem` [RegularConv, GlobalTeamConv]) $ throwS @'InvalidOperation
unless (ty == RegularConv) $ throwS @'InvalidOperation

-- | Ensure that the set of actions provided are not "greater" than the user's
-- own. This is used to ensure users cannot "elevate" allowed actions
Expand Down Expand Up @@ -520,13 +519,9 @@ getConversationWithError ::
Local ConvId ->
UserId ->
Sem r Data.Conversation
getConversationWithError lcnv uid =
getConversationWithError lcnv _uid =
let cid = tUnqualified lcnv
in getConversation cid >>= \case
Just c -> pure c
Nothing -> do
gtc <- noteS @'ConvNotFound =<< getGlobalTeamConversationById lcnv
pure $ gtcToConv gtc uid mempty
in noteS @'ConvNotFound =<< getConversation cid

getConversationAndMemberWithError ::
forall e uid mem r.
Expand Down
Loading