[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 commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost-server/server/v8/cmd/mmctl/client"
|
||||
@@ -19,7 +20,7 @@ func getCommandFromCommandArg(c client.Client, commandArg string) *model.Command
|
||||
|
||||
cmd := getCommandFromTeamTrigger(c, commandArg)
|
||||
if cmd == nil {
|
||||
cmd, _, _ = c.GetCommandById(commandArg)
|
||||
cmd, _, _ = c.GetCommandById(context.TODO(), commandArg)
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
@@ -31,7 +32,7 @@ func getCommandFromTeamTrigger(c client.Client, teamTrigger string) *model.Comma
|
||||
return nil
|
||||
}
|
||||
|
||||
team, _, _ := c.GetTeamByName(arr[0], "")
|
||||
team, _, _ := c.GetTeamByName(context.TODO(), arr[0], "")
|
||||
if team == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -41,7 +42,7 @@ func getCommandFromTeamTrigger(c client.Client, teamTrigger string) *model.Comma
|
||||
return nil
|
||||
}
|
||||
|
||||
list, _, _ := c.ListCommands(team.Id, false)
|
||||
list, _, _ := c.ListCommands(context.TODO(), team.Id, false)
|
||||
if list == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user