Skip to content

Commit f7bee64

Browse files
committed
fix: working
1 parent 0f38f72 commit f7bee64

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

integration/test/Test/TeamCollaborators.hs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ testImplicitConnectionNoCollaborator = do
157157
-- Alice and Bob aren't connected at all.
158158
postOne2OneConversation bob alice team0 "chit-chat" >>= assertLabel 403 "no-team-member"
159159

160-
testRemoveMemberInO2O :: (HasCallStack) => App ()
161-
testRemoveMemberInO2O = do
160+
testRemoveMemberInTeamsO2O :: (HasCallStack) => App ()
161+
testRemoveMemberInTeamsO2O = do
162162
(owner0, team0, [alice]) <- createTeam OwnDomain 2
163163
(owner1, team1, [bob]) <- createTeam OwnDomain 2
164164

@@ -197,6 +197,32 @@ testRemoveMemberInO2OConnected = do
197197

198198
getMLSOne2OneConversation bob alice >>= assertSuccess
199199

200+
testRemoveMemberInO2O :: (HasCallStack) => App ()
201+
testRemoveMemberInO2O = do
202+
(owner0, team0, [alice]) <- createTeam OwnDomain 2
203+
204+
-- At the time of writing, it wasn't clear if this should be a bot instead.
205+
bob <- randomUser OwnDomain def
206+
addTeamCollaborator owner0 team0 bob ["implicit_connection"] >>= assertSuccess
207+
208+
teamConvId <-
209+
postOne2OneConversation bob alice team0 "chit-chat" `bindResponse` \resp -> do
210+
resp.status `shouldMatchInt` 201
211+
resp.json %. "qualified_id"
212+
Internal.getConversation teamConvId >>= assertSuccess
213+
214+
connectTwoUsers alice bob
215+
personalConvId <- postConversation alice defProteus {qualifiedUsers = [bob]} >>= getJSON 201
216+
Internal.getConversation personalConvId >>= assertSuccess
217+
218+
removeTeamCollaborator owner0 team0 bob >>= assertSuccess
219+
220+
postOne2OneConversation bob alice team0 "chit-chat" >>= assertLabel 403 "no-team-member"
221+
Internal.getConversation teamConvId >>= assertLabel 404 "no-conversation"
222+
223+
getMLSOne2OneConversation bob alice >>= assertSuccess
224+
Internal.getConversation personalConvId >>= assertSuccess
225+
200226
testRemoveMemberInTeamConversation :: (HasCallStack) => App ()
201227
testRemoveMemberInTeamConversation = do
202228
(owner, team, [alice, bob]) <- createTeam OwnDomain 3
@@ -210,8 +236,7 @@ testRemoveMemberInTeamConversation = do
210236
withWebSockets [owner, alice] $ \[wsOwner, wsAlice] -> do
211237
removeTeamCollaborator owner team bob >>= assertSuccess
212238

213-
bobId <- bob %. "qualified_id"
214-
bobUnqualifiedId <- bobId %. "id"
239+
bobUnqualifiedId <- bob %. "qualified_id.id"
215240
let checkEvent :: (MakesValue a) => a -> App ()
216241
checkEvent evt = do
217242
evt %. "payload.0.data.user" `shouldMatch` bobUnqualifiedId

services/galley/src/Galley/API/Teams.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ removeTeamCollaborator lusr tid rusr = do
13391339
FeatureStatusDisabled -> Right <$> getTeamMembersForFanout tid
13401340
)
13411341
. (.status)
1342-
uncheckedDeleteTeamMember lusr Nothing tid (tUnqualified lusr) toNotify
1342+
uncheckedDeleteTeamMember lusr Nothing tid rusr toNotify
13431343
internalRemoveTeamCollaborator rusr tid
13441344
where
13451345
-- The @'NotATeamMember@ and @'TeamNotFound@ errors cannot happen at this

0 commit comments

Comments
 (0)