MM-12519: simplify autocomplete team id checking (#9577)

This handles clients sending a team id in a direct message or group channel autocomplete, when it necessarily won't match. Just verify that the user has permission for the team in question, whenever it is provided.
Этот коммит содержится в:
Jesse Hallam
2018-10-09 15:25:57 -04:00
коммит произвёл Christopher Speller
родитель fe9a81208e
Коммит 59319b7915
2 изменённых файлов: 12 добавлений и 19 удалений

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

@@ -873,9 +873,9 @@ func TestAutocompleteUsers(t *testing.T) {
t.Fatal("should not show first/last name")
}
t.Run("team id, if provided, must match channel's team id", func(t *testing.T) {
t.Run("user must have access to team id, especially when it does not match channel's team id", func(t *testing.T) {
rusers, resp = Client.AutocompleteUsersInChannel("otherTeamId", channelId, username, "")
CheckErrorMessage(t, resp, "api.user.autocomplete_users.invalid_team_id")
CheckErrorMessage(t, resp, "api.context.permissions.app_error")
})
}