diff options
author | George Goldberg <george@gberg.me> | 2017-04-03 18:11:12 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-04-03 13:11:12 -0400 |
commit | 232a99f0c7b9364cb4386264f9ff7f97549a4378 (patch) | |
tree | 8f90f7e4fae36b7043e6ab360aafe9e0769060ac /store/sql_user_store.go | |
parent | da5265681d42549ad9072d762fec67293d742d43 (diff) | |
download | chat-232a99f0c7b9364cb4386264f9ff7f97549a4378.tar.gz chat-232a99f0c7b9364cb4386264f9ff7f97549a4378.tar.bz2 chat-232a99f0c7b9364cb4386264f9ff7f97549a4378.zip |
PLT-6162: Search for users not in a given team. (#5943)
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r-- | store/sql_user_store.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 2fb7158ac..bcbd850c8 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -1339,6 +1339,32 @@ func (us SqlUserStore) SearchWithoutTeam(term string, options map[string]bool) S return storeChannel } +func (us SqlUserStore) SearchNotInTeam(notInTeamId string, term string, options map[string]bool) StoreChannel { + storeChannel := make(StoreChannel, 1) + + go func() { + searchQuery := ` + SELECT + Users.* + FROM Users + LEFT JOIN TeamMembers tm + ON tm.UserId = Users.Id + AND tm.TeamId = :NotInTeamId + WHERE + tm.UserId IS NULL + SEARCH_CLAUSE + INACTIVE_CLAUSE + ORDER BY Users.Username ASC + LIMIT 100` + + storeChannel <- us.performSearch(searchQuery, term, options, map[string]interface{}{"NotInTeamId": notInTeamId}) + close(storeChannel) + + }() + + return storeChannel +} + func (us SqlUserStore) SearchNotInChannel(teamId string, channelId string, term string, options map[string]bool) StoreChannel { storeChannel := make(StoreChannel, 1) |