[MM-49989] Pass a context.Context to Client4 methods (#22922)
* Migrate all method in model/client4.go to accept a context.Context * Fix th.*Client * Fix remaining issues * Empty commit to triger CI * Fix test * Add cancellation test * Test that returned error is context.Canceled * Fix bad merge * Update mmctl code --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7116e9267a
Коммит
6c82605df0
@@ -4,6 +4,7 @@
|
||||
package slashcommands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
@@ -42,18 +43,18 @@ func NewAutoUserCreator(a *app.App, client *model.Client4, team *model.Team) *Au
|
||||
|
||||
// Basic test team and user so you always know one
|
||||
func CreateBasicUser(a *app.App, client *model.Client4) error {
|
||||
found, _, _ := client.TeamExists(BTestTeamName, "")
|
||||
found, _, _ := client.TeamExists(context.Background(), BTestTeamName, "")
|
||||
if found {
|
||||
return nil
|
||||
}
|
||||
|
||||
newteam := &model.Team{DisplayName: BTestTeamDisplayName, Name: BTestTeamName, Email: BTestTeamEmail, Type: BTestTeamType}
|
||||
basicteam, _, err := client.CreateTeam(newteam)
|
||||
basicteam, _, err := client.CreateTeam(context.Background(), newteam)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newuser := &model.User{Email: BTestUserEmail, Nickname: BTestUserName, Password: BTestUserPassword}
|
||||
ruser, _, err := client.CreateUser(newuser)
|
||||
ruser, _, err := client.CreateUser(context.Background(), newuser)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user