[MM-25767] Quick switch users search is always falling back to the database (#14762)

* Refactor of getListOfAllowedChannelsForTeam

Also, I've fixed some problematic scenarios:

- The quick search doesn't provide team id so it was always failing
- When the teamId was empty and view restrictions too we always
  return all the channels because if we do "strings.Contains("foo", "")
  it always returns true
- There was a case, in quick search with a guest account, where you
  get an empty result because teamId is not provided

* Error if team id is not passed when searching for the channel

If we search users passing the channel id, we must pass the team id
too so we avoid returning all the channels if we remove the empty
team id restriction we have in the getListOfAllowedChannelsForTeam

There is no known reason to search for a channel but not filtering
using the team id. Even guest accounts belong to a team
Этот коммит содержится в:
Mario de Frutos Dieguez
2020-06-26 20:37:35 +02:00
коммит произвёл GitHub
родитель dd40d59c84
Коммит 4c33b7a35d
6 изменённых файлов: 234 добавлений и 168 удалений

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

@@ -2506,6 +2506,10 @@
"id": "api.user.authorize_oauth_user.unsupported.app_error",
"translation": "Unsupported OAuth service provider."
},
{
"id": "api.user.autocomplete_users.missing_team_id.app_error",
"translation": "Team id parameter is required to autocomplete by channel."
},
{
"id": "api.user.check_user_login_attempts.too_many.app_error",
"translation": "Your account is locked because of too many failed password attempts. Please reset your password."
@@ -6166,10 +6170,6 @@
"id": "store.insert_error",
"translation": "insert error"
},
{
"id": "store.search_user_store.empty_team_id",
"translation": "Failed to get list of allowed channels for team: empty teamId"
},
{
"id": "store.select_error",
"translation": "select error"