коммит произвёл
GitHub
родитель
b45ff0be5d
Коммит
717a4d04a9
@@ -999,7 +999,7 @@ func CheckUserSanitization(tb testing.TB, user *model.User) {
|
||||
require.Equal(tb, "", user.MfaSecret, "mfa secret wasn't blank")
|
||||
}
|
||||
|
||||
func CheckEtag(tb testing.TB, data interface{}, resp *model.Response) {
|
||||
func CheckEtag(tb testing.TB, data any, resp *model.Response) {
|
||||
tb.Helper()
|
||||
|
||||
require.Empty(tb, data)
|
||||
|
||||
@@ -184,7 +184,7 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if oldChannel.Name == model.DefaultChannelName {
|
||||
if channel.Name != "" && channel.Name != oldChannel.Name {
|
||||
c.Err = model.NewAppError("updateChannel", "api.channel.update_channel.tried.app_error", map[string]interface{}{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("updateChannel", "api.channel.update_channel.tried.app_error", map[string]any{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -340,7 +340,7 @@ func patchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if oldChannel.Name == model.DefaultChannelName {
|
||||
if patch.Name != nil && *patch.Name != oldChannel.Name {
|
||||
c.Err = model.NewAppError("patchChannel", "api.channel.update_channel.tried.app_error", map[string]interface{}{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("patchChannel", "api.channel.update_channel.tried.app_error", map[string]any{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1694,7 +1694,7 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if len(nonMembers) > 0 {
|
||||
c.Err = model.NewAppError("addChannelMember", "api.channel.add_members.user_denied", map[string]interface{}{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("addChannelMember", "api.channel.add_members.user_denied", map[string]any{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ func localAddChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if len(nonMembers) > 0 {
|
||||
c.Err = model.NewAppError("localAddChannelMember", "api.channel.add_members.user_denied", map[string]interface{}{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("localAddChannelMember", "api.channel.add_members.user_denied", map[string]any{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,7 +717,7 @@ func TestExecuteGetCommand(t *testing.T) {
|
||||
Text: "test get command response",
|
||||
ResponseType: model.CommandResponseTypeInChannel,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
Props: map[string]any{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -779,7 +779,7 @@ func TestExecutePostCommand(t *testing.T) {
|
||||
Text: "test post command response",
|
||||
ResponseType: model.CommandResponseTypeInChannel,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
Props: map[string]any{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -840,7 +840,7 @@ func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
|
||||
Text: "test post command response",
|
||||
ResponseType: model.CommandResponseTypeInChannel,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
Props: map[string]any{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -892,7 +892,7 @@ func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
|
||||
Text: "test post command response",
|
||||
ResponseType: model.CommandResponseTypeInChannel,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
Props: map[string]any{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -951,7 +951,7 @@ func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
|
||||
Text: "test post command response",
|
||||
ResponseType: model.CommandResponseTypeInChannel,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
Props: map[string]any{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -1015,7 +1015,7 @@ func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
|
||||
Text: "test post command response",
|
||||
ResponseType: model.CommandResponseTypeInChannel,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
Props: map[string]any{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -164,7 +164,7 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
// Both of them cannot be nil since cfg.SetDefaults is called earlier for cfg,
|
||||
// and appCfg is the existing earlier config and if it's nil, server sets a default value.
|
||||
if *appCfg.ComplianceSettings.Directory != *cfg.ComplianceSettings.Directory {
|
||||
c.Err = model.NewAppError("updateConfig", "api.config.update_config.not_allowed_security.app_error", map[string]interface{}{"Name": "ComplianceSettings.Directory"}, "", http.StatusForbidden)
|
||||
c.Err = model.NewAppError("updateConfig", "api.config.update_config.not_allowed_security.app_error", map[string]any{"Name": "ComplianceSettings.Directory"}, "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Do not allow plugin uploads to be toggled through the API
|
||||
if cfg.PluginSettings.EnableUploads != nil && *cfg.PluginSettings.EnableUploads != *appCfg.PluginSettings.EnableUploads {
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.not_allowed_security.app_error", map[string]interface{}{"Name": "PluginSettings.EnableUploads"}, "", http.StatusForbidden)
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.not_allowed_security.app_error", map[string]any{"Name": "PluginSettings.EnableUploads"}, "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if cfg.PluginSettings.MarketplaceURL != nil && cfg.PluginSettings.EnableUploads != nil {
|
||||
// Breaking it down to 2 conditions to make it simple.
|
||||
if *cfg.PluginSettings.MarketplaceURL != *appCfg.PluginSettings.MarketplaceURL && !*cfg.PluginSettings.EnableUploads {
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.not_allowed_security.app_error", map[string]interface{}{"Name": "PluginSettings.MarketplaceURL"}, "", http.StatusForbidden)
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.not_allowed_security.app_error", map[string]any{"Name": "PluginSettings.MarketplaceURL"}, "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
// There are some settings that cannot be changed in a cloud env
|
||||
if c.App.Channels().License() != nil && *c.App.Channels().License().Features.Cloud {
|
||||
if cfg.ComplianceSettings.Directory != nil && *appCfg.ComplianceSettings.Directory != *cfg.ComplianceSettings.Directory {
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.not_allowed_security.app_error", map[string]interface{}{"Name": "ComplianceSettings.Directory"}, "", http.StatusForbidden)
|
||||
c.Err = model.NewAppError("patchConfig", "api.config.update_config.not_allowed_security.app_error", map[string]any{"Name": "ComplianceSettings.Directory"}, "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ func TestGetEnvironmentConfig(t *testing.T) {
|
||||
serviceSettings, ok := envConfig["ServiceSettings"]
|
||||
require.True(t, ok, "should've returned ServiceSettings")
|
||||
|
||||
serviceSettingsAsMap, ok := serviceSettings.(map[string]interface{})
|
||||
serviceSettingsAsMap, ok := serviceSettings.(map[string]any)
|
||||
require.True(t, ok, "should've returned ServiceSettings as a map")
|
||||
|
||||
siteURL, ok := serviceSettingsAsMap["SiteURL"]
|
||||
|
||||
@@ -254,7 +254,7 @@ NextPart:
|
||||
if err != nil && err != io.EOF {
|
||||
c.Err = model.NewAppError("uploadFileMultipart",
|
||||
"api.file.upload_file.read_form_value.app_error",
|
||||
map[string]interface{}{"Formname": formname},
|
||||
map[string]any{"Formname": formname},
|
||||
err.Error(), http.StatusBadRequest)
|
||||
return nil
|
||||
}
|
||||
@@ -367,7 +367,7 @@ NextPart:
|
||||
if expectClientIds && len(clientIds) != nFiles {
|
||||
c.Err = model.NewAppError("uploadFileMultipart",
|
||||
"api.file.upload_file.incorrect_number_of_client_ids.app_error",
|
||||
map[string]interface{}{"NumClientIds": len(clientIds), "NumFiles": nFiles},
|
||||
map[string]any{"NumClientIds": len(clientIds), "NumFiles": nFiles},
|
||||
"", http.StatusBadRequest)
|
||||
return nil
|
||||
}
|
||||
@@ -412,7 +412,7 @@ func uploadFileMultipartLegacy(c *Context, mr *multipart.Reader,
|
||||
if len(clientIds) != 0 && len(clientIds) != len(fileHeaders) {
|
||||
c.Err = model.NewAppError("uploadFilesMultipartBuffered",
|
||||
"api.file.upload_file.incorrect_number_of_client_ids.app_error",
|
||||
map[string]interface{}{"NumClientIds": len(clientIds), "NumFiles": len(fileHeaders)},
|
||||
map[string]any{"NumClientIds": len(clientIds), "NumFiles": len(fileHeaders)},
|
||||
"", http.StatusBadRequest)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
)
|
||||
|
||||
type graphQLInput struct {
|
||||
Query string `json:"query"`
|
||||
OperationName string `json:"operationName"`
|
||||
Variables map[string]interface{} `json:"variables"`
|
||||
Query string `json:"query"`
|
||||
OperationName string `json:"operationName"`
|
||||
Variables map[string]any `json:"variables"`
|
||||
}
|
||||
|
||||
// Unique type to hold our context.
|
||||
|
||||
@@ -65,7 +65,7 @@ func TestPostActionCookies(t *testing.T) {
|
||||
Type: model.PostActionTypeButton,
|
||||
Integration: &model.PostActionIntegration{
|
||||
URL: server.URL,
|
||||
Context: map[string]interface{}{
|
||||
Context: map[string]any{
|
||||
"test-key": "test-value",
|
||||
},
|
||||
},
|
||||
@@ -80,7 +80,7 @@ func TestPostActionCookies(t *testing.T) {
|
||||
Type: model.PostActionTypeButton,
|
||||
Integration: &model.PostActionIntegration{
|
||||
URL: server.URL,
|
||||
Context: map[string]interface{}{
|
||||
Context: map[string]any{
|
||||
"test-key": "test-value",
|
||||
},
|
||||
},
|
||||
@@ -95,7 +95,7 @@ func TestPostActionCookies(t *testing.T) {
|
||||
Type: model.PostActionTypeButton,
|
||||
Integration: &model.PostActionIntegration{
|
||||
URL: server.URL,
|
||||
Context: map[string]interface{}{
|
||||
Context: map[string]any{
|
||||
"test-key": "test-value",
|
||||
},
|
||||
},
|
||||
@@ -112,7 +112,7 @@ func TestPostActionCookies(t *testing.T) {
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
CreateAt: model.GetMillis(),
|
||||
UpdateAt: model.GetMillis(),
|
||||
Props: map[string]interface{}{
|
||||
Props: map[string]any{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
{
|
||||
Title: "some-title",
|
||||
@@ -226,7 +226,7 @@ func TestSubmitDialog(t *testing.T) {
|
||||
UserId: th.BasicUser.Id,
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
TeamId: th.BasicTeam.Id,
|
||||
Submission: map[string]interface{}{"somename": "somevalue"},
|
||||
Submission: map[string]any{"somename": "somevalue"},
|
||||
}
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestGetOpenGraphMetadata(t *testing.T) {
|
||||
}
|
||||
}))
|
||||
|
||||
for _, data := range [](map[string]interface{}){
|
||||
for _, data := range [](map[string]any){
|
||||
{"path": "/og-data/", "title": "Test Title", "cacheMissCount": 1},
|
||||
{"path": "/no-og-data/", "title": "", "cacheMissCount": 2},
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
for {
|
||||
select {
|
||||
case resp := <-webSocketClient.EventChannel:
|
||||
if resp.EventType() == model.WebsocketEventPluginStatusesChanged && len(resp.GetData()["plugin_statuses"].([]interface{})) == 0 {
|
||||
if resp.EventType() == model.WebsocketEventPluginStatusesChanged && len(resp.GetData()["plugin_statuses"].([]any)) == 0 {
|
||||
done <- true
|
||||
return
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ func getPostsByIds(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if len(postIDs) > 1000 {
|
||||
c.Err = model.NewAppError("getPostsByIds", "api.post.posts_by_ids.invalid_body.request_error", map[string]interface{}{"MaxLength": 1000}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("getPostsByIds", "api.post.posts_by_ids.invalid_body.request_error", map[string]any{"MaxLength": 1000}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
err := json.Unmarshal([]byte(event.GetData()["post"].(string)), &wpost)
|
||||
require.NoError(t, err)
|
||||
|
||||
acm, ok := wpost.GetProp(model.PropsAddChannelMember).(map[string]interface{})
|
||||
acm, ok := wpost.GetProp(model.PropsAddChannelMember).(map[string]any)
|
||||
require.True(t, ok, "should have received ephemeral post with 'add_channel_member' in props")
|
||||
require.True(t, acm["post_id"] != nil, "should not be nil")
|
||||
require.True(t, acm["user_ids"] != nil, "should not be nil")
|
||||
@@ -2120,7 +2120,7 @@ func TestDeletePostMessage(t *testing.T) {
|
||||
testCases := []struct {
|
||||
description string
|
||||
client *model.Client4
|
||||
delete_by interface{}
|
||||
delete_by any
|
||||
}{
|
||||
{"Do not send delete_by to regular user", th.Client, nil},
|
||||
{"Send delete_by to system admin user", th.SystemAdminClient, th.SystemAdminUser.Id},
|
||||
@@ -2857,7 +2857,7 @@ func TestSetPostUnreadWithoutCollapsedThreads(t *testing.T) {
|
||||
// test websocket event for marking post as unread
|
||||
var caught bool
|
||||
var exit bool
|
||||
var data map[string]interface{}
|
||||
var data map[string]any
|
||||
for {
|
||||
select {
|
||||
case ev := <-userWSClient.EventChannel:
|
||||
@@ -3105,7 +3105,7 @@ func TestGetPostStripActionIntegrations(t *testing.T) {
|
||||
Name: "test-name",
|
||||
Integration: &model.PostActionIntegration{
|
||||
URL: "https://test.test/action",
|
||||
Context: map[string]interface{}{
|
||||
Context: map[string]any{
|
||||
"test-ctx": "some-value",
|
||||
},
|
||||
},
|
||||
@@ -3120,13 +3120,13 @@ func TestGetPostStripActionIntegrations(t *testing.T) {
|
||||
|
||||
actualPost, _, err := client.GetPost(rpost.Id, "")
|
||||
require.NoError(t, err)
|
||||
attachments, _ := actualPost.Props["attachments"].([]interface{})
|
||||
attachments, _ := actualPost.Props["attachments"].([]any)
|
||||
require.Equal(t, 1, len(attachments))
|
||||
att, _ := attachments[0].(map[string]interface{})
|
||||
att, _ := attachments[0].(map[string]any)
|
||||
require.NotNil(t, att)
|
||||
actions, _ := att["actions"].([]interface{})
|
||||
actions, _ := att["actions"].([]any)
|
||||
require.Equal(t, 1, len(actions))
|
||||
action, _ := actions[0].(map[string]interface{})
|
||||
action, _ := actions[0].(map[string]any)
|
||||
require.NotNil(t, action)
|
||||
// integration must be omitted
|
||||
require.Nil(t, action["integration"])
|
||||
|
||||
@@ -182,7 +182,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"user": model.NewId(),
|
||||
},
|
||||
}
|
||||
@@ -211,7 +211,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
},
|
||||
}
|
||||
@@ -225,7 +225,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
"after": q.ChannelMembers[3].Cursor,
|
||||
},
|
||||
@@ -240,7 +240,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
"after": q.ChannelMembers[3].Cursor,
|
||||
},
|
||||
@@ -265,7 +265,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"channelId": ch1.Id,
|
||||
"first": 4,
|
||||
},
|
||||
@@ -281,7 +281,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"channelId": model.NewId(),
|
||||
"first": 3,
|
||||
},
|
||||
@@ -304,7 +304,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"teamId": th.BasicTeam.Id,
|
||||
},
|
||||
}
|
||||
@@ -318,7 +318,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"teamId": th.BasicTeam.Id,
|
||||
"excludeTeam": true,
|
||||
},
|
||||
@@ -347,7 +347,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
"lastUpdateAt": float64(now),
|
||||
},
|
||||
@@ -365,7 +365,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channelMembers",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
"lastUpdateAt": float64(now),
|
||||
},
|
||||
|
||||
@@ -128,7 +128,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": u1.Id,
|
||||
},
|
||||
}
|
||||
@@ -157,7 +157,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
},
|
||||
}
|
||||
@@ -171,7 +171,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
"after": q.Channels[3].Cursor,
|
||||
},
|
||||
@@ -186,7 +186,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 4,
|
||||
"after": q.Channels[3].Cursor,
|
||||
},
|
||||
@@ -209,7 +209,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 10,
|
||||
"teamId": myTeam.Id,
|
||||
},
|
||||
@@ -224,7 +224,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 2,
|
||||
"teamId": myTeam.Id,
|
||||
},
|
||||
@@ -251,7 +251,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 2,
|
||||
"teamId": myTeam.Id,
|
||||
},
|
||||
@@ -286,7 +286,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"includeDeleted": false,
|
||||
},
|
||||
}
|
||||
@@ -301,7 +301,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"includeDeleted": true,
|
||||
"lastUpdateAt": float64(now),
|
||||
},
|
||||
@@ -318,7 +318,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"includeDeleted": true,
|
||||
"lastUpdateAt": float64(now),
|
||||
},
|
||||
@@ -339,7 +339,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"includeDeleted": false,
|
||||
},
|
||||
}
|
||||
@@ -353,7 +353,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"includeDeleted": true,
|
||||
"lastDeleteAt": float64(model.GetMillis()),
|
||||
},
|
||||
@@ -368,7 +368,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input = graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"includeDeleted": true,
|
||||
"lastDeleteAt": float64(model.GetMillis()),
|
||||
"first": 5,
|
||||
@@ -396,7 +396,7 @@ func TestGraphQLChannels(t *testing.T) {
|
||||
input := graphQLInput{
|
||||
OperationName: "channels",
|
||||
Query: query,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"first": 10,
|
||||
"teamId": myTeam.Id,
|
||||
},
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestGraphQLSidebarCategories(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
"teamId": th.BasicTeam.Id,
|
||||
},
|
||||
@@ -83,7 +83,7 @@ func TestGraphQLSidebarCategories(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
"teamId": th.BasicTeam.Id,
|
||||
"excludeTeam": true,
|
||||
@@ -117,7 +117,7 @@ func TestGraphQLSidebarCategories(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
"teamId": th.BasicTeam.Id,
|
||||
"excludeTeam": true,
|
||||
|
||||
@@ -75,7 +75,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
},
|
||||
}
|
||||
@@ -128,7 +128,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
"teamId": th.BasicTeam.Id,
|
||||
},
|
||||
@@ -180,7 +180,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
},
|
||||
}
|
||||
@@ -233,7 +233,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
"teamId": th.BasicTeam.Id,
|
||||
},
|
||||
@@ -257,7 +257,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"userId": "me",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func TestGraphQLChannelsLeft(t *testing.T) {
|
||||
channelsLeft(userId: $userId, since: $since)
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"since": model.GetMillis(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ func TestGraphQLUser(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"id": th.BasicUser2.Id,
|
||||
},
|
||||
}
|
||||
@@ -203,7 +203,7 @@ func TestGraphQLUser(t *testing.T) {
|
||||
}
|
||||
}
|
||||
`,
|
||||
Variables: map[string]interface{}{
|
||||
Variables: map[string]any{
|
||||
"id": id,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -281,6 +281,6 @@ func resetAuthDataToEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.Err = appErr
|
||||
return
|
||||
}
|
||||
b, _ := json.Marshal(map[string]interface{}{"num_affected": numAffected})
|
||||
b, _ := json.Marshal(map[string]any{"num_affected": numAffected})
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
@@ -693,7 +693,7 @@ func upgradeToEnterprise(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var iaErr *upgrader.InvalidArch
|
||||
switch {
|
||||
case errors.As(err, &ipErr):
|
||||
params := map[string]interface{}{
|
||||
params := map[string]any{
|
||||
"MattermostUsername": ipErr.MattermostUsername,
|
||||
"FileUsername": ipErr.FileUsername,
|
||||
"Path": ipErr.Path,
|
||||
@@ -729,19 +729,19 @@ func upgradeToEnterpriseStatus(c *Context, w http.ResponseWriter, r *http.Reques
|
||||
}
|
||||
|
||||
percentage, err := c.App.Srv().UpgradeToE0Status()
|
||||
var s map[string]interface{}
|
||||
var s map[string]any
|
||||
if err != nil {
|
||||
var isErr *upgrader.InvalidSignature
|
||||
switch {
|
||||
case errors.As(err, &isErr):
|
||||
appErr := model.NewAppError("upgradeToEnterpriseStatus", "api.upgrade_to_enterprise_status.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
s = map[string]interface{}{"percentage": 0, "error": appErr.Message}
|
||||
s = map[string]any{"percentage": 0, "error": appErr.Message}
|
||||
default:
|
||||
appErr := model.NewAppError("upgradeToEnterpriseStatus", "api.upgrade_to_enterprise_status.signature.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
s = map[string]interface{}{"percentage": 0, "error": appErr.Message}
|
||||
s = map[string]any{"percentage": 0, "error": appErr.Message}
|
||||
}
|
||||
} else {
|
||||
s = map[string]interface{}{"percentage": percentage, "error": nil}
|
||||
s = map[string]any{"percentage": percentage, "error": nil}
|
||||
}
|
||||
|
||||
w.Write([]byte(model.StringInterfaceToJSON(s)))
|
||||
@@ -974,7 +974,7 @@ func getAppliedSchemaMigrations(c *Context, w http.ResponseWriter, r *http.Reque
|
||||
|
||||
// returns true if the data has nil fields
|
||||
// this is being used for testS3 and testEmail methods
|
||||
func checkHasNilFields(value interface{}) bool {
|
||||
func checkHasNilFields(value any) bool {
|
||||
v := reflect.Indirect(reflect.ValueOf(value))
|
||||
if v.Kind() != reflect.Struct {
|
||||
return false
|
||||
|
||||
@@ -738,7 +738,7 @@ func addTeamMember(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if len(nonMembers) > 0 {
|
||||
c.Err = model.NewAppError("addTeamMember", "api.team.add_members.user_denied", map[string]interface{}{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("addTeamMember", "api.team.add_members.user_denied", map[string]any{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -851,7 +851,7 @@ func addTeamMembers(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if len(nonMembers) > 0 {
|
||||
c.Err = model.NewAppError("addTeamMembers", "api.team.add_members.user_denied", map[string]interface{}{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("addTeamMembers", "api.team.add_members.user_denied", map[string]any{"UserIDs": nonMembers}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1185,7 +1185,7 @@ func searchTeams(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var payload []byte
|
||||
if props.Page != nil && props.PerPage != nil {
|
||||
twc := map[string]interface{}{"teams": teams, "total_count": totalCount}
|
||||
twc := map[string]any{"teams": teams, "total_count": totalCount}
|
||||
payload = model.ToJSON(twc)
|
||||
} else {
|
||||
js, jsonErr := json.Marshal(teams)
|
||||
|
||||
@@ -97,7 +97,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
|
||||
for i := range emailList {
|
||||
email := strings.ToLower(emailList[i])
|
||||
if !model.IsValidEmail(email) {
|
||||
c.Err = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]interface{}{"Address": email}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]any{"Address": email}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
emailList[i] = email
|
||||
@@ -145,7 +145,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
|
||||
Error: nil,
|
||||
}
|
||||
if !isEmailAddressAllowed(email, allowedDomains) {
|
||||
invite.Error = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]interface{}{"Addresses": email}, "", http.StatusBadRequest)
|
||||
invite.Error = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]any{"Addresses": email}, "", http.StatusBadRequest)
|
||||
errList = append(errList, model.EmailInviteWithErrorToString(invite))
|
||||
} else {
|
||||
goodEmails = append(goodEmails, email)
|
||||
@@ -192,7 +192,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
if len(invalidEmailList) > 0 {
|
||||
s := strings.Join(invalidEmailList, ", ")
|
||||
c.Err = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]interface{}{"Addresses": s}, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("localInviteUsersToTeam", "api.team.invite_members.invalid_email.app_error", map[string]any{"Addresses": s}, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
err := c.App.Srv().EmailService.SendInviteEmails(team, "Administrator", "mmctl "+model.NewId(), emailList, *c.App.Config().ServiceSettings.SiteURL, nil, false)
|
||||
|
||||
@@ -3120,7 +3120,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
nameFormat := *th.App.Config().TeamSettings.TeammateNameDisplay
|
||||
expectedSubject := i18n.T("api.templates.invite_subject",
|
||||
map[string]interface{}{"SenderName": th.SystemAdminUser.GetDisplayName(nameFormat),
|
||||
map[string]any{"SenderName": th.SystemAdminUser.GetDisplayName(nameFormat),
|
||||
"TeamDisplayName": th.BasicTeam.DisplayName,
|
||||
"SiteName": th.App.ClientConfig()["SiteName"]})
|
||||
checkEmail(t, expectedSubject)
|
||||
@@ -3131,7 +3131,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
||||
_, _, err = th.SystemAdminClient.InviteUsersToTeamAndChannelsGracefully(th.BasicTeam.Id, []string{user1, user2}, []string{th.BasicChannel.Id}, "")
|
||||
require.NoError(t, err)
|
||||
expectedSubject = i18n.T("api.templates.invite_team_and_channel_subject",
|
||||
map[string]interface{}{"SenderName": th.SystemAdminUser.GetDisplayName(nameFormat),
|
||||
map[string]any{"SenderName": th.SystemAdminUser.GetDisplayName(nameFormat),
|
||||
"TeamDisplayName": th.BasicTeam.DisplayName,
|
||||
"ChannelName": th.BasicChannel.DisplayName,
|
||||
"SiteName": th.App.ClientConfig()["SiteName"]})
|
||||
@@ -3142,7 +3142,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
||||
_, err = th.LocalClient.InviteUsersToTeam(th.BasicTeam.Id, emailList)
|
||||
require.NoError(t, err)
|
||||
expectedSubject = i18n.T("api.templates.invite_subject",
|
||||
map[string]interface{}{"SenderName": "Administrator",
|
||||
map[string]any{"SenderName": "Administrator",
|
||||
"TeamDisplayName": th.BasicTeam.DisplayName,
|
||||
"SiteName": th.App.ClientConfig()["SiteName"]})
|
||||
checkEmail(t, expectedSubject)
|
||||
@@ -3153,7 +3153,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
||||
_, _, err = th.LocalClient.InviteUsersToTeamAndChannelsGracefully(th.BasicTeam.Id, []string{user1, user2}, []string{th.BasicChannel.Id}, "")
|
||||
require.NoError(t, err)
|
||||
expectedSubject = i18n.T("api.templates.invite_team_and_channel_subject",
|
||||
map[string]interface{}{"SenderName": "Administrator",
|
||||
map[string]any{"SenderName": "Administrator",
|
||||
"TeamDisplayName": th.BasicTeam.DisplayName,
|
||||
"ChannelName": th.BasicChannel.DisplayName,
|
||||
"SiteName": th.App.ClientConfig()["SiteName"]})
|
||||
@@ -3277,7 +3277,7 @@ func TestInviteGuestsToTeam(t *testing.T) {
|
||||
|
||||
nameFormat := *th.App.Config().TeamSettings.TeammateNameDisplay
|
||||
expectedSubject := i18n.T("api.templates.invite_guest_subject",
|
||||
map[string]interface{}{"SenderName": th.SystemAdminUser.GetDisplayName(nameFormat),
|
||||
map[string]any{"SenderName": th.SystemAdminUser.GetDisplayName(nameFormat),
|
||||
"TeamDisplayName": th.BasicTeam.DisplayName,
|
||||
"SiteName": th.App.ClientConfig()["SiteName"]})
|
||||
|
||||
|
||||
@@ -1210,7 +1210,7 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if conflictField != "" {
|
||||
c.Err = model.NewAppError(
|
||||
"updateUser", "api.user.update_user.login_provider_attribute_set.app_error",
|
||||
map[string]interface{}{"Field": conflictField}, "", http.StatusConflict)
|
||||
map[string]any{"Field": conflictField}, "", http.StatusConflict)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1283,7 +1283,7 @@ func patchUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if conflictField != "" {
|
||||
c.Err = model.NewAppError(
|
||||
"patchUser", "api.user.patch_user.login_provider_attribute_set.app_error",
|
||||
map[string]interface{}{"Field": conflictField}, "", http.StatusConflict)
|
||||
map[string]any{"Field": conflictField}, "", http.StatusConflict)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2933,7 +2933,7 @@ func migrateAuthToSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.SetInvalidParam("auto")
|
||||
return
|
||||
}
|
||||
matches, ok := props["matches"].(map[string]interface{})
|
||||
matches, ok := props["matches"].(map[string]any)
|
||||
if !ok {
|
||||
c.SetInvalidParam("matches")
|
||||
return
|
||||
|
||||
@@ -267,7 +267,7 @@ func TestWebSocketSendBinary(t *testing.T) {
|
||||
require.True(t, ok)
|
||||
require.Equal(t, model.StatusOnline, status)
|
||||
|
||||
WebSocketClient.SendBinaryMessage("get_statuses_by_ids", map[string]interface{}{
|
||||
WebSocketClient.SendBinaryMessage("get_statuses_by_ids", map[string]any{
|
||||
"user_ids": []string{th.BasicUser2.Id},
|
||||
})
|
||||
status, ok = resp.Data[th.BasicUser2.Id]
|
||||
|
||||
Ссылка в новой задаче
Block a user