From 1e89ef73143e2ba9ff5217ec44da947400635b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Thu, 2 Apr 2020 17:22:08 +0200 Subject: [PATCH] Fixing searching users without team (#14182) --- store/searchlayer/user_layer.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/store/searchlayer/user_layer.go b/store/searchlayer/user_layer.go index a63700d958..67f6928597 100644 --- a/store/searchlayer/user_layer.go +++ b/store/searchlayer/user_layer.go @@ -40,7 +40,8 @@ func (s *SearchUserStore) Search(teamId, term string, options *model.UserSearchO mlog.Error("Encountered error on Search.", mlog.String("search_engine", engine.GetName()), mlog.Err(err)) continue } - if len(listOfAllowedChannels) == 0 { + + if listOfAllowedChannels != nil && len(listOfAllowedChannels) == 0 { return []*model.User{}, nil } @@ -147,6 +148,10 @@ func (s *SearchUserStore) getListOfAllowedChannelsForTeam(teamId string, viewRes } var listOfAllowedChannels []string + if viewRestrictions == nil && teamId == "" { + return nil, nil + } + if viewRestrictions == nil || strings.Contains(strings.Join(viewRestrictions.Teams, "."), teamId) { channels, err := s.rootStore.Channel().GetTeamChannels(teamId) if err != nil {