diff --git a/changelog.d/3-bug-fixes/WPB-15072 b/changelog.d/3-bug-fixes/WPB-15072 new file mode 100644 index 00000000000..60dbbe6f537 --- /dev/null +++ b/changelog.d/3-bug-fixes/WPB-15072 @@ -0,0 +1 @@ +Send team active event in personal user to team flow diff --git a/integration/test/API/GalleyInternal.hs b/integration/test/API/GalleyInternal.hs index bb8a471ce36..65592f37108 100644 --- a/integration/test/API/GalleyInternal.hs +++ b/integration/test/API/GalleyInternal.hs @@ -119,3 +119,8 @@ patchTeamFeature domain team featureName payload = do tid <- asString team req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "teams", tid, "features", featureName] submit "PATCH" $ req & addJSON payload + +getTeam :: (HasCallStack, MakesValue domain) => domain -> String -> App Response +getTeam domain tid = do + req <- baseRequest domain Galley Unversioned $ joinHttpPath ["i", "teams", tid] + submit "GET" $ req diff --git a/integration/test/Test/Teams.hs b/integration/test/Test/Teams.hs index 2d566527c0e..ed834c4c169 100644 --- a/integration/test/Test/Teams.hs +++ b/integration/test/Test/Teams.hs @@ -22,7 +22,7 @@ import API.Brig import qualified API.BrigInternal as I import API.Common import API.Galley (getTeam, getTeamMembers, getTeamMembersCsv, getTeamNotifications) -import API.GalleyInternal (setTeamFeatureStatus) +import qualified API.GalleyInternal as I import API.Gundeck import qualified API.Nginz as Nginz import Control.Monad.Codensity (Codensity (runCodensity)) @@ -58,7 +58,7 @@ testInvitePersonalUserToTeam = do resp.json %. "invitations" `shouldMatch` ([] :: [()]) ownerId <- owner %. "id" & asString - setTeamFeatureStatus domain tid "exposeInvitationURLsToTeamAdmin" "enabled" >>= assertSuccess + I.setTeamFeatureStatus domain tid "exposeInvitationURLsToTeamAdmin" "enabled" >>= assertSuccess user <- I.createUser domain def >>= getJSON 201 uid <- user %. "id" >>= asString email <- user %. "email" >>= asString @@ -289,6 +289,10 @@ testUpgradePersonalToTeam = do team <- getTeam alice tid >>= getJSON 200 team %. "name" `shouldMatch` teamName + iTeam <- asString tid >>= I.getTeam alice >>= getJSON 200 + iTeam %. "team.name" `shouldMatch` teamName + iTeam %. "status" `shouldMatch` "active" + bindResponse (getTeamMembers alice tid) $ \resp -> do resp.status `shouldMatchInt` 200 owner <- asList (resp.json %. "members") >>= assertOne diff --git a/services/brig/src/Brig/API/User.hs b/services/brig/src/Brig/API/User.hs index c6adbf99ffd..4d16684d9b1 100644 --- a/services/brig/src/Brig/API/User.hs +++ b/services/brig/src/Brig/API/User.hs @@ -289,6 +289,7 @@ upgradePersonalToTeam luid bNewTeam = do liftSem $ GalleyAPIAccess.createTeam uid (bnuTeam bNewTeam) tid let newTeam = bNewTeam.bnuTeam pure $ CreateUserTeam tid (fromRange newTeam.newTeamName) + liftSem $ GalleyAPIAccess.changeTeamStatus tid Team.Active bNewTeam.bnuCurrency liftSem $ updateUserTeam uid tid liftSem $ User.internalUpdateSearchIndex uid