PLT-6603: Don't return all posts on invalid query. (#7061)

If the query contains only * or invalid punctuation only components,
don't return all posts - instead return no results.

This also fixes PLT-6608
Этот коммит содержится в:
George Goldberg
2017-07-31 19:45:35 +01:00
коммит произвёл Christopher Speller
родитель 8a91235fb3
Коммит 25a2013890

Просмотреть файл

@@ -532,6 +532,11 @@ func SearchPostsInTeam(terms string, userId string, teamId string, isOrSearch bo
}
}
// If the processed search params are empty, return empty search results.
if len(finalParamsList) == 0 {
return model.NewPostList(), nil
}
// We only allow the user to search in channels they are a member of.
userChannels, err := GetChannelsForUser(teamId, userId)
if err != nil {