Skip to content
Merged
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
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/WPB-14856
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed search index after personal user creates team
6 changes: 6 additions & 0 deletions integration/test/API/Brig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ searchTeam user q = do
req <- baseRequest user Brig Versioned $ joinHttpPath ["teams", tid, "search"]
submit "GET" (req & addQueryParams [("q", q)])

searchTeamAll :: (HasCallStack, MakesValue user) => user -> App Response
searchTeamAll user = do
tid <- user %. "team" & asString
req <- baseRequest user Brig Versioned $ joinHttpPath ["teams", tid, "search"]
submit "GET" (req & addQueryParams [("q", ""), ("size", "100"), ("sortby", "created_at"), ("sortorder", "desc")])

getAPIVersion :: (HasCallStack, MakesValue domain) => domain -> App Response
getAPIVersion domain = do
req <- baseRequest domain Brig Unversioned $ "/api-version"
Expand Down
10 changes: 10 additions & 0 deletions integration/test/Test/Teams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ testUpgradePersonalToTeam = do
shouldBeNull $ owner %. "created_at"
shouldBeNull $ owner %. "created_by"

mem <- createTeamMember alice' def
I.refreshIndex OwnDomain

bindResponse (searchTeamAll alice') $ \resp -> do
resp.status `shouldMatchInt` 200
docs <- resp.json %. "documents" >>= asList
actualIds <- for docs ((%. "id") >=> asString)
expectedIds <- for [alice', mem] ((%. "id") >=> asString)
actualIds `shouldMatchSet` expectedIds

testUpgradePersonalToTeamAlreadyInATeam :: (HasCallStack) => App ()
testUpgradePersonalToTeamAlreadyInATeam = do
(alice, _, _) <- createTeam OwnDomain 0
Expand Down
1 change: 1 addition & 0 deletions services/brig/src/Brig/API/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ upgradePersonalToTeam luid bNewTeam = do
pure $ CreateUserTeam tid (fromRange newTeam.newTeamName)

liftSem $ updateUserTeam uid tid
liftSem $ User.internalUpdateSearchIndex uid
liftSem $ Intra.sendUserEvent uid Nothing (teamUpdated uid tid)
initAccountFeatureConfig uid

Expand Down