PLT-4697 Update channel switcher to autocomplete all users on the system (#4624)
* Add autocomplete API for system-wide users * Update channel switcher to autocomplete all users on the system
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
ad52183248
Коммит
02d581c159
@@ -2275,6 +2275,44 @@ func TestAutocompleteUsers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
Client := th.BasicClient
|
||||
|
||||
if result, err := Client.AutocompleteUsers(th.BasicUser.Username); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
users := result.Data.([]*model.User)
|
||||
if len(users) != 1 {
|
||||
t.Fatal("should have returned 1 user in")
|
||||
}
|
||||
}
|
||||
|
||||
if result, err := Client.AutocompleteUsers(""); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
users := result.Data.([]*model.User)
|
||||
if len(users) == 0 {
|
||||
t.Fatal("should have many users")
|
||||
}
|
||||
}
|
||||
|
||||
notInTeamUser := th.CreateUser(Client)
|
||||
|
||||
if result, err := Client.AutocompleteUsers(notInTeamUser.Username); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
users := result.Data.([]*model.User)
|
||||
if len(users) != 1 {
|
||||
t.Fatal("should have returned 1 user in")
|
||||
}
|
||||
}
|
||||
|
||||
if result, err := Client.AutocompleteUsersInTeam(notInTeamUser.Username); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
autocomplete := result.Data.(*model.UserAutocompleteInTeam)
|
||||
if len(autocomplete.InTeam) != 0 {
|
||||
t.Fatal("should have returned 0 users")
|
||||
}
|
||||
}
|
||||
|
||||
if result, err := Client.AutocompleteUsersInTeam(th.BasicUser.Username); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
|
||||
Ссылка в новой задаче
Block a user