* replace interface{} with any
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-07-05 09:46:50 +03:00
коммит произвёл GitHub
родитель b45ff0be5d
Коммит 717a4d04a9
258 изменённых файлов: 1286 добавлений и 1286 удалений

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

@@ -999,7 +999,7 @@ func CheckUserSanitization(tb testing.TB, user *model.User) {
require.Equal(tb, "", user.MfaSecret, "mfa secret wasn't blank") 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() tb.Helper()
require.Empty(tb, data) require.Empty(tb, data)

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

@@ -184,7 +184,7 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
if oldChannel.Name == model.DefaultChannelName { if oldChannel.Name == model.DefaultChannelName {
if channel.Name != "" && channel.Name != oldChannel.Name { 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 return
} }
} }
@@ -340,7 +340,7 @@ func patchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
if oldChannel.Name == model.DefaultChannelName { if oldChannel.Name == model.DefaultChannelName {
if patch.Name != nil && *patch.Name != oldChannel.Name { 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 return
} }
} }
@@ -1694,7 +1694,7 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if len(nonMembers) > 0 { 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 return
} }
} }

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

@@ -201,7 +201,7 @@ func localAddChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if len(nonMembers) > 0 { 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 return
} }
} }

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

@@ -717,7 +717,7 @@ func TestExecuteGetCommand(t *testing.T) {
Text: "test get command response", Text: "test get command response",
ResponseType: model.CommandResponseTypeInChannel, ResponseType: model.CommandResponseTypeInChannel,
Type: "custom_test", 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) { 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", Text: "test post command response",
ResponseType: model.CommandResponseTypeInChannel, ResponseType: model.CommandResponseTypeInChannel,
Type: "custom_test", 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) { 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", Text: "test post command response",
ResponseType: model.CommandResponseTypeInChannel, ResponseType: model.CommandResponseTypeInChannel,
Type: "custom_test", 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) { 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", Text: "test post command response",
ResponseType: model.CommandResponseTypeInChannel, ResponseType: model.CommandResponseTypeInChannel,
Type: "custom_test", 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) { 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", Text: "test post command response",
ResponseType: model.CommandResponseTypeInChannel, ResponseType: model.CommandResponseTypeInChannel,
Type: "custom_test", 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) { 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", Text: "test post command response",
ResponseType: model.CommandResponseTypeInChannel, ResponseType: model.CommandResponseTypeInChannel,
Type: "custom_test", 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) { 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, // 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. // and appCfg is the existing earlier config and if it's nil, server sets a default value.
if *appCfg.ComplianceSettings.Directory != *cfg.ComplianceSettings.Directory { 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 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 // Do not allow plugin uploads to be toggled through the API
if cfg.PluginSettings.EnableUploads != nil && *cfg.PluginSettings.EnableUploads != *appCfg.PluginSettings.EnableUploads { 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 return
} }
@@ -289,7 +289,7 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
if cfg.PluginSettings.MarketplaceURL != nil && cfg.PluginSettings.EnableUploads != nil { if cfg.PluginSettings.MarketplaceURL != nil && cfg.PluginSettings.EnableUploads != nil {
// Breaking it down to 2 conditions to make it simple. // Breaking it down to 2 conditions to make it simple.
if *cfg.PluginSettings.MarketplaceURL != *appCfg.PluginSettings.MarketplaceURL && !*cfg.PluginSettings.EnableUploads { 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 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 // 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 c.App.Channels().License() != nil && *c.App.Channels().License().Features.Cloud {
if cfg.ComplianceSettings.Directory != nil && *appCfg.ComplianceSettings.Directory != *cfg.ComplianceSettings.Directory { 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 return
} }
} }

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

@@ -595,7 +595,7 @@ func TestGetEnvironmentConfig(t *testing.T) {
serviceSettings, ok := envConfig["ServiceSettings"] serviceSettings, ok := envConfig["ServiceSettings"]
require.True(t, ok, "should've returned 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") require.True(t, ok, "should've returned ServiceSettings as a map")
siteURL, ok := serviceSettingsAsMap["SiteURL"] siteURL, ok := serviceSettingsAsMap["SiteURL"]

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

@@ -254,7 +254,7 @@ NextPart:
if err != nil && err != io.EOF { if err != nil && err != io.EOF {
c.Err = model.NewAppError("uploadFileMultipart", c.Err = model.NewAppError("uploadFileMultipart",
"api.file.upload_file.read_form_value.app_error", "api.file.upload_file.read_form_value.app_error",
map[string]interface{}{"Formname": formname}, map[string]any{"Formname": formname},
err.Error(), http.StatusBadRequest) err.Error(), http.StatusBadRequest)
return nil return nil
} }
@@ -367,7 +367,7 @@ NextPart:
if expectClientIds && len(clientIds) != nFiles { if expectClientIds && len(clientIds) != nFiles {
c.Err = model.NewAppError("uploadFileMultipart", c.Err = model.NewAppError("uploadFileMultipart",
"api.file.upload_file.incorrect_number_of_client_ids.app_error", "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) "", http.StatusBadRequest)
return nil return nil
} }
@@ -412,7 +412,7 @@ func uploadFileMultipartLegacy(c *Context, mr *multipart.Reader,
if len(clientIds) != 0 && len(clientIds) != len(fileHeaders) { if len(clientIds) != 0 && len(clientIds) != len(fileHeaders) {
c.Err = model.NewAppError("uploadFilesMultipartBuffered", c.Err = model.NewAppError("uploadFilesMultipartBuffered",
"api.file.upload_file.incorrect_number_of_client_ids.app_error", "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) "", http.StatusBadRequest)
return nil return nil
} }

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

@@ -18,9 +18,9 @@ import (
) )
type graphQLInput struct { type graphQLInput struct {
Query string `json:"query"` Query string `json:"query"`
OperationName string `json:"operationName"` OperationName string `json:"operationName"`
Variables map[string]interface{} `json:"variables"` Variables map[string]any `json:"variables"`
} }
// Unique type to hold our context. // Unique type to hold our context.

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

@@ -65,7 +65,7 @@ func TestPostActionCookies(t *testing.T) {
Type: model.PostActionTypeButton, Type: model.PostActionTypeButton,
Integration: &model.PostActionIntegration{ Integration: &model.PostActionIntegration{
URL: server.URL, URL: server.URL,
Context: map[string]interface{}{ Context: map[string]any{
"test-key": "test-value", "test-key": "test-value",
}, },
}, },
@@ -80,7 +80,7 @@ func TestPostActionCookies(t *testing.T) {
Type: model.PostActionTypeButton, Type: model.PostActionTypeButton,
Integration: &model.PostActionIntegration{ Integration: &model.PostActionIntegration{
URL: server.URL, URL: server.URL,
Context: map[string]interface{}{ Context: map[string]any{
"test-key": "test-value", "test-key": "test-value",
}, },
}, },
@@ -95,7 +95,7 @@ func TestPostActionCookies(t *testing.T) {
Type: model.PostActionTypeButton, Type: model.PostActionTypeButton,
Integration: &model.PostActionIntegration{ Integration: &model.PostActionIntegration{
URL: server.URL, URL: server.URL,
Context: map[string]interface{}{ Context: map[string]any{
"test-key": "test-value", "test-key": "test-value",
}, },
}, },
@@ -112,7 +112,7 @@ func TestPostActionCookies(t *testing.T) {
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
CreateAt: model.GetMillis(), CreateAt: model.GetMillis(),
UpdateAt: model.GetMillis(), UpdateAt: model.GetMillis(),
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Title: "some-title", Title: "some-title",
@@ -226,7 +226,7 @@ func TestSubmitDialog(t *testing.T) {
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
TeamId: th.BasicTeam.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) { 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": "/og-data/", "title": "Test Title", "cacheMissCount": 1},
{"path": "/no-og-data/", "title": "", "cacheMissCount": 2}, {"path": "/no-og-data/", "title": "", "cacheMissCount": 2},

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

@@ -342,7 +342,7 @@ func TestNotifyClusterPluginEvent(t *testing.T) {
for { for {
select { select {
case resp := <-webSocketClient.EventChannel: 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 done <- true
return return
} }

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

@@ -425,7 +425,7 @@ func getPostsByIds(c *Context, w http.ResponseWriter, r *http.Request) {
} }
if len(postIDs) > 1000 { 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 return
} }

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

@@ -586,7 +586,7 @@ func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
err := json.Unmarshal([]byte(event.GetData()["post"].(string)), &wpost) err := json.Unmarshal([]byte(event.GetData()["post"].(string)), &wpost)
require.NoError(t, err) 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, 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["post_id"] != nil, "should not be nil")
require.True(t, acm["user_ids"] != 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 { testCases := []struct {
description string description string
client *model.Client4 client *model.Client4
delete_by interface{} delete_by any
}{ }{
{"Do not send delete_by to regular user", th.Client, nil}, {"Do not send delete_by to regular user", th.Client, nil},
{"Send delete_by to system admin user", th.SystemAdminClient, th.SystemAdminUser.Id}, {"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 // test websocket event for marking post as unread
var caught bool var caught bool
var exit bool var exit bool
var data map[string]interface{} var data map[string]any
for { for {
select { select {
case ev := <-userWSClient.EventChannel: case ev := <-userWSClient.EventChannel:
@@ -3105,7 +3105,7 @@ func TestGetPostStripActionIntegrations(t *testing.T) {
Name: "test-name", Name: "test-name",
Integration: &model.PostActionIntegration{ Integration: &model.PostActionIntegration{
URL: "https://test.test/action", URL: "https://test.test/action",
Context: map[string]interface{}{ Context: map[string]any{
"test-ctx": "some-value", "test-ctx": "some-value",
}, },
}, },
@@ -3120,13 +3120,13 @@ func TestGetPostStripActionIntegrations(t *testing.T) {
actualPost, _, err := client.GetPost(rpost.Id, "") actualPost, _, err := client.GetPost(rpost.Id, "")
require.NoError(t, err) require.NoError(t, err)
attachments, _ := actualPost.Props["attachments"].([]interface{}) attachments, _ := actualPost.Props["attachments"].([]any)
require.Equal(t, 1, len(attachments)) require.Equal(t, 1, len(attachments))
att, _ := attachments[0].(map[string]interface{}) att, _ := attachments[0].(map[string]any)
require.NotNil(t, att) require.NotNil(t, att)
actions, _ := att["actions"].([]interface{}) actions, _ := att["actions"].([]any)
require.Equal(t, 1, len(actions)) require.Equal(t, 1, len(actions))
action, _ := actions[0].(map[string]interface{}) action, _ := actions[0].(map[string]any)
require.NotNil(t, action) require.NotNil(t, action)
// integration must be omitted // integration must be omitted
require.Nil(t, action["integration"]) 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(), "user": model.NewId(),
}, },
} }
@@ -211,7 +211,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
}, },
} }
@@ -225,7 +225,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
"after": q.ChannelMembers[3].Cursor, "after": q.ChannelMembers[3].Cursor,
}, },
@@ -240,7 +240,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
"after": q.ChannelMembers[3].Cursor, "after": q.ChannelMembers[3].Cursor,
}, },
@@ -265,7 +265,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"channelId": ch1.Id, "channelId": ch1.Id,
"first": 4, "first": 4,
}, },
@@ -281,7 +281,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"channelId": model.NewId(), "channelId": model.NewId(),
"first": 3, "first": 3,
}, },
@@ -304,7 +304,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
}, },
} }
@@ -318,7 +318,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
"excludeTeam": true, "excludeTeam": true,
}, },
@@ -347,7 +347,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
"lastUpdateAt": float64(now), "lastUpdateAt": float64(now),
}, },
@@ -365,7 +365,7 @@ func TestGraphQLChannelMembers(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channelMembers", OperationName: "channelMembers",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
"lastUpdateAt": float64(now), "lastUpdateAt": float64(now),
}, },

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

@@ -128,7 +128,7 @@ func TestGraphQLChannels(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": u1.Id, "userId": u1.Id,
}, },
} }
@@ -157,7 +157,7 @@ func TestGraphQLChannels(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
}, },
} }
@@ -171,7 +171,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
"after": q.Channels[3].Cursor, "after": q.Channels[3].Cursor,
}, },
@@ -186,7 +186,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 4, "first": 4,
"after": q.Channels[3].Cursor, "after": q.Channels[3].Cursor,
}, },
@@ -209,7 +209,7 @@ func TestGraphQLChannels(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 10, "first": 10,
"teamId": myTeam.Id, "teamId": myTeam.Id,
}, },
@@ -224,7 +224,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 2, "first": 2,
"teamId": myTeam.Id, "teamId": myTeam.Id,
}, },
@@ -251,7 +251,7 @@ func TestGraphQLChannels(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 2, "first": 2,
"teamId": myTeam.Id, "teamId": myTeam.Id,
}, },
@@ -286,7 +286,7 @@ func TestGraphQLChannels(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"includeDeleted": false, "includeDeleted": false,
}, },
} }
@@ -301,7 +301,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"includeDeleted": true, "includeDeleted": true,
"lastUpdateAt": float64(now), "lastUpdateAt": float64(now),
}, },
@@ -318,7 +318,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"includeDeleted": true, "includeDeleted": true,
"lastUpdateAt": float64(now), "lastUpdateAt": float64(now),
}, },
@@ -339,7 +339,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"includeDeleted": false, "includeDeleted": false,
}, },
} }
@@ -353,7 +353,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"includeDeleted": true, "includeDeleted": true,
"lastDeleteAt": float64(model.GetMillis()), "lastDeleteAt": float64(model.GetMillis()),
}, },
@@ -368,7 +368,7 @@ func TestGraphQLChannels(t *testing.T) {
input = graphQLInput{ input = graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"includeDeleted": true, "includeDeleted": true,
"lastDeleteAt": float64(model.GetMillis()), "lastDeleteAt": float64(model.GetMillis()),
"first": 5, "first": 5,
@@ -396,7 +396,7 @@ func TestGraphQLChannels(t *testing.T) {
input := graphQLInput{ input := graphQLInput{
OperationName: "channels", OperationName: "channels",
Query: query, Query: query,
Variables: map[string]interface{}{ Variables: map[string]any{
"first": 10, "first": 10,
"teamId": myTeam.Id, "teamId": myTeam.Id,
}, },

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

@@ -42,7 +42,7 @@ func TestGraphQLSidebarCategories(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
}, },
@@ -83,7 +83,7 @@ func TestGraphQLSidebarCategories(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
"excludeTeam": true, "excludeTeam": true,
@@ -117,7 +117,7 @@ func TestGraphQLSidebarCategories(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
"excludeTeam": true, "excludeTeam": true,

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

@@ -75,7 +75,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
}, },
} }
@@ -128,7 +128,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
}, },
@@ -180,7 +180,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
}, },
} }
@@ -233,7 +233,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
"teamId": th.BasicTeam.Id, "teamId": th.BasicTeam.Id,
}, },
@@ -257,7 +257,7 @@ func TestGraphQLTeamMembers(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"userId": "me", "userId": "me",
}, },
} }

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

@@ -131,7 +131,7 @@ func TestGraphQLChannelsLeft(t *testing.T) {
channelsLeft(userId: $userId, since: $since) channelsLeft(userId: $userId, since: $since)
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"since": model.GetMillis(), "since": model.GetMillis(),
}, },
} }

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

@@ -178,7 +178,7 @@ func TestGraphQLUser(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"id": th.BasicUser2.Id, "id": th.BasicUser2.Id,
}, },
} }
@@ -203,7 +203,7 @@ func TestGraphQLUser(t *testing.T) {
} }
} }
`, `,
Variables: map[string]interface{}{ Variables: map[string]any{
"id": id, "id": id,
}, },
} }

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

@@ -281,6 +281,6 @@ func resetAuthDataToEmail(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = appErr c.Err = appErr
return return
} }
b, _ := json.Marshal(map[string]interface{}{"num_affected": numAffected}) b, _ := json.Marshal(map[string]any{"num_affected": numAffected})
w.Write(b) w.Write(b)
} }

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

@@ -693,7 +693,7 @@ func upgradeToEnterprise(c *Context, w http.ResponseWriter, r *http.Request) {
var iaErr *upgrader.InvalidArch var iaErr *upgrader.InvalidArch
switch { switch {
case errors.As(err, &ipErr): case errors.As(err, &ipErr):
params := map[string]interface{}{ params := map[string]any{
"MattermostUsername": ipErr.MattermostUsername, "MattermostUsername": ipErr.MattermostUsername,
"FileUsername": ipErr.FileUsername, "FileUsername": ipErr.FileUsername,
"Path": ipErr.Path, "Path": ipErr.Path,
@@ -729,19 +729,19 @@ func upgradeToEnterpriseStatus(c *Context, w http.ResponseWriter, r *http.Reques
} }
percentage, err := c.App.Srv().UpgradeToE0Status() percentage, err := c.App.Srv().UpgradeToE0Status()
var s map[string]interface{} var s map[string]any
if err != nil { if err != nil {
var isErr *upgrader.InvalidSignature var isErr *upgrader.InvalidSignature
switch { switch {
case errors.As(err, &isErr): case errors.As(err, &isErr):
appErr := model.NewAppError("upgradeToEnterpriseStatus", "api.upgrade_to_enterprise_status.app_error", nil, err.Error(), http.StatusBadRequest) 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: default:
appErr := model.NewAppError("upgradeToEnterpriseStatus", "api.upgrade_to_enterprise_status.signature.app_error", nil, err.Error(), http.StatusBadRequest) 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 { } else {
s = map[string]interface{}{"percentage": percentage, "error": nil} s = map[string]any{"percentage": percentage, "error": nil}
} }
w.Write([]byte(model.StringInterfaceToJSON(s))) 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 // returns true if the data has nil fields
// this is being used for testS3 and testEmail methods // 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)) v := reflect.Indirect(reflect.ValueOf(value))
if v.Kind() != reflect.Struct { if v.Kind() != reflect.Struct {
return false return false

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

@@ -738,7 +738,7 @@ func addTeamMember(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if len(nonMembers) > 0 { 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 return
} }
} }
@@ -851,7 +851,7 @@ func addTeamMembers(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if len(nonMembers) > 0 { 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 return
} }
} }
@@ -1185,7 +1185,7 @@ func searchTeams(c *Context, w http.ResponseWriter, r *http.Request) {
var payload []byte var payload []byte
if props.Page != nil && props.PerPage != nil { 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) payload = model.ToJSON(twc)
} else { } else {
js, jsonErr := json.Marshal(teams) js, jsonErr := json.Marshal(teams)

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

@@ -97,7 +97,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
for i := range emailList { for i := range emailList {
email := strings.ToLower(emailList[i]) email := strings.ToLower(emailList[i])
if !model.IsValidEmail(email) { 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 return
} }
emailList[i] = email emailList[i] = email
@@ -145,7 +145,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
Error: nil, Error: nil,
} }
if !isEmailAddressAllowed(email, allowedDomains) { 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)) errList = append(errList, model.EmailInviteWithErrorToString(invite))
} else { } else {
goodEmails = append(goodEmails, email) goodEmails = append(goodEmails, email)
@@ -192,7 +192,7 @@ func localInviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request)
} }
if len(invalidEmailList) > 0 { if len(invalidEmailList) > 0 {
s := strings.Join(invalidEmailList, ", ") 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 return
} }
err := c.App.Srv().EmailService.SendInviteEmails(team, "Administrator", "mmctl "+model.NewId(), emailList, *c.App.Config().ServiceSettings.SiteURL, nil, false) 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) require.NoError(t, err)
nameFormat := *th.App.Config().TeamSettings.TeammateNameDisplay nameFormat := *th.App.Config().TeamSettings.TeammateNameDisplay
expectedSubject := i18n.T("api.templates.invite_subject", 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, "TeamDisplayName": th.BasicTeam.DisplayName,
"SiteName": th.App.ClientConfig()["SiteName"]}) "SiteName": th.App.ClientConfig()["SiteName"]})
checkEmail(t, expectedSubject) 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}, "") _, _, err = th.SystemAdminClient.InviteUsersToTeamAndChannelsGracefully(th.BasicTeam.Id, []string{user1, user2}, []string{th.BasicChannel.Id}, "")
require.NoError(t, err) require.NoError(t, err)
expectedSubject = i18n.T("api.templates.invite_team_and_channel_subject", 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, "TeamDisplayName": th.BasicTeam.DisplayName,
"ChannelName": th.BasicChannel.DisplayName, "ChannelName": th.BasicChannel.DisplayName,
"SiteName": th.App.ClientConfig()["SiteName"]}) "SiteName": th.App.ClientConfig()["SiteName"]})
@@ -3142,7 +3142,7 @@ func TestInviteUsersToTeam(t *testing.T) {
_, err = th.LocalClient.InviteUsersToTeam(th.BasicTeam.Id, emailList) _, err = th.LocalClient.InviteUsersToTeam(th.BasicTeam.Id, emailList)
require.NoError(t, err) require.NoError(t, err)
expectedSubject = i18n.T("api.templates.invite_subject", expectedSubject = i18n.T("api.templates.invite_subject",
map[string]interface{}{"SenderName": "Administrator", map[string]any{"SenderName": "Administrator",
"TeamDisplayName": th.BasicTeam.DisplayName, "TeamDisplayName": th.BasicTeam.DisplayName,
"SiteName": th.App.ClientConfig()["SiteName"]}) "SiteName": th.App.ClientConfig()["SiteName"]})
checkEmail(t, expectedSubject) 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}, "") _, _, err = th.LocalClient.InviteUsersToTeamAndChannelsGracefully(th.BasicTeam.Id, []string{user1, user2}, []string{th.BasicChannel.Id}, "")
require.NoError(t, err) require.NoError(t, err)
expectedSubject = i18n.T("api.templates.invite_team_and_channel_subject", expectedSubject = i18n.T("api.templates.invite_team_and_channel_subject",
map[string]interface{}{"SenderName": "Administrator", map[string]any{"SenderName": "Administrator",
"TeamDisplayName": th.BasicTeam.DisplayName, "TeamDisplayName": th.BasicTeam.DisplayName,
"ChannelName": th.BasicChannel.DisplayName, "ChannelName": th.BasicChannel.DisplayName,
"SiteName": th.App.ClientConfig()["SiteName"]}) "SiteName": th.App.ClientConfig()["SiteName"]})
@@ -3277,7 +3277,7 @@ func TestInviteGuestsToTeam(t *testing.T) {
nameFormat := *th.App.Config().TeamSettings.TeammateNameDisplay nameFormat := *th.App.Config().TeamSettings.TeammateNameDisplay
expectedSubject := i18n.T("api.templates.invite_guest_subject", 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, "TeamDisplayName": th.BasicTeam.DisplayName,
"SiteName": th.App.ClientConfig()["SiteName"]}) "SiteName": th.App.ClientConfig()["SiteName"]})

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

@@ -1210,7 +1210,7 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
if conflictField != "" { if conflictField != "" {
c.Err = model.NewAppError( c.Err = model.NewAppError(
"updateUser", "api.user.update_user.login_provider_attribute_set.app_error", "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 return
} }
@@ -1283,7 +1283,7 @@ func patchUser(c *Context, w http.ResponseWriter, r *http.Request) {
if conflictField != "" { if conflictField != "" {
c.Err = model.NewAppError( c.Err = model.NewAppError(
"patchUser", "api.user.patch_user.login_provider_attribute_set.app_error", "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 return
} }
@@ -2933,7 +2933,7 @@ func migrateAuthToSaml(c *Context, w http.ResponseWriter, r *http.Request) {
c.SetInvalidParam("auto") c.SetInvalidParam("auto")
return return
} }
matches, ok := props["matches"].(map[string]interface{}) matches, ok := props["matches"].(map[string]any)
if !ok { if !ok {
c.SetInvalidParam("matches") c.SetInvalidParam("matches")
return return

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

@@ -267,7 +267,7 @@ func TestWebSocketSendBinary(t *testing.T) {
require.True(t, ok) require.True(t, ok)
require.Equal(t, model.StatusOnline, status) 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}, "user_ids": []string{th.BasicUser2.Id},
}) })
status, ok = resp.Data[th.BasicUser2.Id] status, ok = resp.Data[th.BasicUser2.Id]

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

@@ -209,7 +209,7 @@ func (a *App) TestSiteURL(siteURL string) *model.AppError {
func (a *App) TestEmail(userID string, cfg *model.Config) *model.AppError { func (a *App) TestEmail(userID string, cfg *model.Config) *model.AppError {
if *cfg.EmailSettings.SMTPServer == "" { if *cfg.EmailSettings.SMTPServer == "" {
return model.NewAppError("testEmail", "api.admin.test_email.missing_server", nil, i18n.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"}), http.StatusBadRequest) return model.NewAppError("testEmail", "api.admin.test_email.missing_server", nil, i18n.T("api.context.invalid_param.app_error", map[string]any{"Name": "SMTPServer"}), http.StatusBadRequest)
} }
// if the user hasn't changed their email settings, fill in the actual SMTP password so that // if the user hasn't changed their email settings, fill in the actual SMTP password so that
@@ -232,7 +232,7 @@ func (a *App) TestEmail(userID string, cfg *model.Config) *model.AppError {
license := a.Srv().License() license := a.Srv().License()
mailConfig := a.Srv().MailServiceConfig() mailConfig := a.Srv().MailServiceConfig()
if err := mail.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), mailConfig, license != nil && *license.Features.Compliance, "", "", "", ""); err != nil { if err := mail.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), mailConfig, license != nil && *license.Features.Compliance, "", "", "", ""); err != nil {
return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError) return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]any{"Error": err.Error()}, "", http.StatusInternalServerError)
} }
return nil return nil

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

@@ -156,7 +156,7 @@ func (a *App) NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User,
if !forceAck { if !forceAck {
if *a.Config().EmailSettings.SMTPServer == "" { if *a.Config().EmailSettings.SMTPServer == "" {
return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.missing_server.app_error", nil, i18n.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"}), http.StatusInternalServerError) return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.missing_server.app_error", nil, i18n.T("api.context.invalid_param.app_error", map[string]any{"Name": "SMTPServer"}), http.StatusInternalServerError)
} }
T := i18n.GetUserTranslations(sender.Locale) T := i18n.GetUserTranslations(sender.Locale)
data := a.Srv().EmailService.NewEmailTemplateData(sender.Locale) data := a.Srv().EmailService.NewEmailTemplateData(sender.Locale)
@@ -191,11 +191,11 @@ func (a *App) NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User,
body, err := a.Srv().TemplatesContainer().RenderToString("warn_metric_ack", data) body, err := a.Srv().TemplatesContainer().RenderToString("warn_metric_ack", data)
if err != nil { if err != nil {
return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.failure.app_error", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError) return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.failure.app_error", map[string]any{"Error": err.Error()}, "", http.StatusInternalServerError)
} }
if err := mail.SendMailUsingConfig(model.MmSupportAdvisorAddress, subject, body, mailConfig, false, "", "", "", sender.Email); err != nil { if err := mail.SendMailUsingConfig(model.MmSupportAdvisorAddress, subject, body, mailConfig, false, "", "", "", sender.Email); err != nil {
return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.failure.app_error", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError) return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.failure.app_error", map[string]any{"Error": err.Error()}, "", http.StatusInternalServerError)
} }
} }
@@ -236,7 +236,7 @@ func (a *App) setWarnMetricsStatusForId(warnMetricId string, status string) *mod
Name: warnMetricId, Name: warnMetricId,
Value: status, Value: status,
}); err != nil { }); err != nil {
return model.NewAppError("setWarnMetricsStatusForId", "app.system.warn_metric.store.app_error", map[string]interface{}{"WarnMetricName": warnMetricId}, err.Error(), http.StatusInternalServerError) return model.NewAppError("setWarnMetricsStatusForId", "app.system.warn_metric.store.app_error", map[string]any{"WarnMetricName": warnMetricId}, err.Error(), http.StatusInternalServerError)
} }
return nil return nil
} }

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

@@ -170,7 +170,7 @@ type AppIface interface {
GetEmojiStaticURL(emojiName string) (string, *model.AppError) GetEmojiStaticURL(emojiName string) (string, *model.AppError)
// GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable. // GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable.
// If filter is not nil and returns false for a struct field, that field will be omitted. // If filter is not nil and returns false for a struct field, that field will be omitted.
GetEnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} GetEnvironmentConfig(filter func(reflect.StructField) bool) map[string]any
// GetFilteredUsersStats is used to get a count of users based on the set of filters supported by UserCountOptions. // GetFilteredUsersStats is used to get a count of users based on the set of filters supported by UserCountOptions.
GetFilteredUsersStats(options *model.UserCountOptions) (*model.UsersStats, *model.AppError) GetFilteredUsersStats(options *model.UserCountOptions) (*model.UsersStats, *model.AppError)
// GetGroupsByTeam returns the paged list and the total count of group associated to the given team. // GetGroupsByTeam returns the paged list and the total count of group associated to the given team.
@@ -540,7 +540,7 @@ type AppIface interface {
DoUploadFileExpectModification(c *request.Context, now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) DoUploadFileExpectModification(c *request.Context, now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)
DownloadFromURL(downloadURL string) ([]byte, error) DownloadFromURL(downloadURL string) ([]byte, error)
EnableUserAccessToken(token *model.UserAccessToken) *model.AppError EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
EnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} EnvironmentConfig(filter func(reflect.StructField) bool) map[string]any
ExportPermissions(w io.Writer) error ExportPermissions(w io.Writer) error
ExtractContentFromFileInfo(fileInfo *model.FileInfo) error ExtractContentFromFileInfo(fileInfo *model.FileInfo) error
FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError) FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
@@ -751,7 +751,7 @@ type AppIface interface {
GetSiteURL() string GetSiteURL() string
GetStatus(userID string) (*model.Status, *model.AppError) GetStatus(userID string) (*model.Status, *model.AppError)
GetStatusFromCache(userID string) *model.Status GetStatusFromCache(userID string) *model.Status
GetStatusesByIds(userIDs []string) (map[string]interface{}, *model.AppError) GetStatusesByIds(userIDs []string) (map[string]any, *model.AppError)
GetSystemBot() (*model.Bot, *model.AppError) GetSystemBot() (*model.Bot, *model.AppError)
GetTeam(teamID string) (*model.Team, *model.AppError) GetTeam(teamID string) (*model.Team, *model.AppError)
GetTeamByInviteId(inviteId string) (*model.Team, *model.AppError) GetTeamByInviteId(inviteId string) (*model.Team, *model.AppError)

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

@@ -50,7 +50,7 @@ func (a *App) IsPasswordValid(password string) *model.AppError {
var invErr *users.ErrInvalidPassword var invErr *users.ErrInvalidPassword
switch { switch {
case errors.As(err, &invErr): case errors.As(err, &invErr):
return model.NewAppError("User.IsValid", invErr.Id(), map[string]interface{}{"Min": *a.Config().PasswordSettings.MinimumLength}, "", http.StatusBadRequest) return model.NewAppError("User.IsValid", invErr.Id(), map[string]any{"Min": *a.Config().PasswordSettings.MinimumLength}, "", http.StatusBadRequest)
default: default:
return model.NewAppError("User.IsValid", "app.valid_password_generic.app_error", nil, err.Error(), http.StatusInternalServerError) return model.NewAppError("User.IsValid", "app.valid_password_generic.app_error", nil, err.Error(), http.StatusInternalServerError)
} }
@@ -266,7 +266,7 @@ func (a *App) authenticateUser(c *request.Context, user *model.User, password, m
if authService == model.UserAuthServiceSaml { if authService == model.UserAuthServiceSaml {
authService = strings.ToUpper(authService) authService = strings.ToUpper(authService)
} }
err := model.NewAppError("login", "api.user.login.use_auth_service.app_error", map[string]interface{}{"AuthService": authService}, "", http.StatusBadRequest) err := model.NewAppError("login", "api.user.login.use_auth_service.app_error", map[string]any{"AuthService": authService}, "", http.StatusBadRequest)
return user, err return user, err
} }

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

@@ -447,7 +447,7 @@ func (a *App) PermanentDeleteBot(botUserId string) *model.AppError {
var invErr *store.ErrInvalidInput var invErr *store.ErrInvalidInput
switch { switch {
case errors.As(err, &invErr): case errors.As(err, &invErr):
return model.NewAppError("PermanentDeleteBot", "app.bot.permenent_delete.bad_id", map[string]interface{}{"user_id": invErr.Value}, invErr.Error(), http.StatusBadRequest) return model.NewAppError("PermanentDeleteBot", "app.bot.permenent_delete.bad_id", map[string]any{"user_id": invErr.Value}, invErr.Error(), http.StatusBadRequest)
default: // last fallback in case it doesn't map to an existing app error. default: // last fallback in case it doesn't map to an existing app error.
return model.NewAppError("PatchBot", "app.bot.permanent_delete.internal_error", nil, err.Error(), http.StatusInternalServerError) return model.NewAppError("PatchBot", "app.bot.permanent_delete.internal_error", nil, err.Error(), http.StatusInternalServerError)
} }
@@ -626,7 +626,7 @@ func (a *App) getDisableBotSysadminMessage(user *model.User, userBots model.BotL
T := i18n.GetUserTranslations(user.Locale) T := i18n.GetUserTranslations(user.Locale)
message = T("app.bot.get_disable_bot_sysadmin_message", message = T("app.bot.get_disable_bot_sysadmin_message",
map[string]interface{}{ map[string]any{
"UserName": user.Username, "UserName": user.Username,
"NumBots": len(userBots), "NumBots": len(userBots),
"BotNames": botList, "BotNames": botList,

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

@@ -188,7 +188,7 @@ func (a *App) CreateChannelWithUser(c *request.Context, channel *model.Channel,
} }
if int64(count+1) > *a.Config().TeamSettings.MaxChannelsPerTeam { if int64(count+1) > *a.Config().TeamSettings.MaxChannelsPerTeam {
return nil, model.NewAppError("CreateChannelWithUser", "api.channel.create_channel.max_channel_limit.app_error", map[string]interface{}{"MaxChannelsPerTeam": *a.Config().TeamSettings.MaxChannelsPerTeam}, "", http.StatusBadRequest) return nil, model.NewAppError("CreateChannelWithUser", "api.channel.create_channel.max_channel_limit.app_error", map[string]any{"MaxChannelsPerTeam": *a.Config().TeamSettings.MaxChannelsPerTeam}, "", http.StatusBadRequest)
} }
channel.CreatorId = userID channel.CreatorId = userID
@@ -799,7 +799,7 @@ func (a *App) RestoreChannel(c *request.Context, channel *model.Channel, userID
post := &model.Post{ post := &model.Post{
ChannelId: channel.Id, ChannelId: channel.Id,
Message: T("api.channel.restore_channel.unarchived", map[string]interface{}{"Username": user.Username}), Message: T("api.channel.restore_channel.unarchived", map[string]any{"Username": user.Username}),
Type: model.PostTypeChannelRestored, Type: model.PostTypeChannelRestored,
UserId: userID, UserId: userID,
Props: model.StringInterface{ Props: model.StringInterface{
@@ -820,7 +820,7 @@ func (a *App) RestoreChannel(c *request.Context, channel *model.Channel, userID
post := &model.Post{ post := &model.Post{
ChannelId: channel.Id, ChannelId: channel.Id,
Message: i18n.T("api.channel.restore_channel.unarchived", map[string]interface{}{"Username": systemBot.Username}), Message: i18n.T("api.channel.restore_channel.unarchived", map[string]any{"Username": systemBot.Username}),
Type: model.PostTypeChannelRestored, Type: model.PostTypeChannelRestored,
UserId: systemBot.UserId, UserId: systemBot.UserId,
Props: model.StringInterface{ Props: model.StringInterface{
@@ -1363,7 +1363,7 @@ func (a *App) DeleteChannel(c *request.Context, channel *model.Channel, userID s
} }
if channel.Name == model.DefaultChannelName { if channel.Name == model.DefaultChannelName {
err := model.NewAppError("deleteChannel", "api.channel.delete_channel.cannot.app_error", map[string]interface{}{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest) err := model.NewAppError("deleteChannel", "api.channel.delete_channel.cannot.app_error", map[string]any{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest)
return err return err
} }
@@ -1457,7 +1457,7 @@ func (a *App) addUserToChannel(user *model.User, channel *model.Channel) (*model
return nil, model.NewAppError("addUserToChannel", "api.channel.add_user_to_channel.type.app_error", nil, "", http.StatusInternalServerError) return nil, model.NewAppError("addUserToChannel", "api.channel.add_user_to_channel.type.app_error", nil, "", http.StatusInternalServerError)
} }
if len(nonMembers) > 0 { if len(nonMembers) > 0 {
return nil, model.NewAppError("addUserToChannel", "api.channel.add_members.user_denied", map[string]interface{}{"UserIDs": nonMembers}, "", http.StatusBadRequest) return nil, model.NewAppError("addUserToChannel", "api.channel.add_members.user_denied", map[string]any{"UserIDs": nonMembers}, "", http.StatusBadRequest)
} }
} }
@@ -1594,7 +1594,7 @@ func (a *App) AddDirectChannels(teamID string, user *model.User) *model.AppError
options := &model.UserGetOptions{InTeamId: teamID, Page: 0, PerPage: 100} options := &model.UserGetOptions{InTeamId: teamID, Page: 0, PerPage: 100}
profiles, err := a.Srv().Store.User().GetProfiles(options) profiles, err := a.Srv().Store.User().GetProfiles(options)
if err != nil { if err != nil {
return model.NewAppError("AddDirectChannels", "api.user.add_direct_channels_and_forget.failed.error", map[string]interface{}{"UserId": user.Id, "TeamId": teamID, "Error": err.Error()}, "", http.StatusInternalServerError) return model.NewAppError("AddDirectChannels", "api.user.add_direct_channels_and_forget.failed.error", map[string]any{"UserId": user.Id, "TeamId": teamID, "Error": err.Error()}, "", http.StatusInternalServerError)
} }
var preferences model.Preferences var preferences model.Preferences
@@ -1619,7 +1619,7 @@ func (a *App) AddDirectChannels(teamID string, user *model.User) *model.AppError
} }
if err := a.Srv().Store.Preference().Save(preferences); err != nil { if err := a.Srv().Store.Preference().Save(preferences); err != nil {
return model.NewAppError("AddDirectChannels", "api.user.add_direct_channels_and_forget.failed.error", map[string]interface{}{"UserId": user.Id, "TeamId": teamID, "Error": err.Error()}, "", http.StatusInternalServerError) return model.NewAppError("AddDirectChannels", "api.user.add_direct_channels_and_forget.failed.error", map[string]any{"UserId": user.Id, "TeamId": teamID, "Error": err.Error()}, "", http.StatusInternalServerError)
} }
return nil return nil
@@ -2404,7 +2404,7 @@ func (a *App) removeUserFromChannel(c *request.Context, userIDToRemove string, r
if channel.Name == model.DefaultChannelName { if channel.Name == model.DefaultChannelName {
if !isGuest { if !isGuest {
return model.NewAppError("RemoveUserFromChannel", "api.channel.remove.default.app_error", map[string]interface{}{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest) return model.NewAppError("RemoveUserFromChannel", "api.channel.remove.default.app_error", map[string]any{"Channel": model.DefaultChannelName}, "", http.StatusBadRequest)
} }
} }
@@ -2414,7 +2414,7 @@ func (a *App) removeUserFromChannel(c *request.Context, userIDToRemove string, r
return model.NewAppError("removeUserFromChannel", "api.channel.remove_user_from_channel.app_error", nil, err.Error(), http.StatusInternalServerError) return model.NewAppError("removeUserFromChannel", "api.channel.remove_user_from_channel.app_error", nil, err.Error(), http.StatusInternalServerError)
} }
if len(nonMembers) == 0 { if len(nonMembers) == 0 {
return model.NewAppError("removeUserFromChannel", "api.channel.remove_members.denied", map[string]interface{}{"UserIDs": nonMembers}, "", http.StatusBadRequest) return model.NewAppError("removeUserFromChannel", "api.channel.remove_members.denied", map[string]any{"UserIDs": nonMembers}, "", http.StatusBadRequest)
} }
} }
@@ -3302,11 +3302,11 @@ func (a *App) FillInChannelsProps(channelList model.ChannelList) *model.AppError
} }
for _, channel := range channelList { for _, channel := range channelList {
channelMentionsProp := make(map[string]interface{}, len(channelMentions[channel])) channelMentionsProp := make(map[string]any, len(channelMentions[channel]))
for _, channelMention := range channelMentions[channel] { for _, channelMention := range channelMentions[channel] {
if mentioned, ok := mentionedChannelsByName[channelMention]; ok { if mentioned, ok := mentionedChannelsByName[channelMention]; ok {
if mentioned.Type == model.ChannelTypeOpen { if mentioned.Type == model.ChannelTypeOpen {
channelMentionsProp[mentioned.Name] = map[string]interface{}{ channelMentionsProp[mentioned.Name] = map[string]any{
"display_name": mentioned.DisplayName, "display_name": mentioned.DisplayName,
} }
} }

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

@@ -759,7 +759,7 @@ func TestFillInChannelProps(t *testing.T) {
testCases := []struct { testCases := []struct {
Description string Description string
Channel *model.Channel Channel *model.Channel
ExpectedChannelProps map[string]interface{} ExpectedChannelProps map[string]any
}{ }{
{ {
"channel on basic team without references", "channel on basic team without references",
@@ -777,9 +777,9 @@ func TestFillInChannelProps(t *testing.T) {
Header: "~public1, ~private, ~other-team", Header: "~public1, ~private, ~other-team",
Purpose: "~public2, ~private, ~other-team", Purpose: "~public2, ~private, ~other-team",
}, },
map[string]interface{}{ map[string]any{
"channel_mentions": map[string]interface{}{ "channel_mentions": map[string]any{
"public1": map[string]interface{}{ "public1": map[string]any{
"display_name": "Public 1", "display_name": "Public 1",
}, },
}, },
@@ -792,9 +792,9 @@ func TestFillInChannelProps(t *testing.T) {
Header: "~public1, ~private, ~other-team", Header: "~public1, ~private, ~other-team",
Purpose: "~public2, ~private, ~other-team", Purpose: "~public2, ~private, ~other-team",
}, },
map[string]interface{}{ map[string]any{
"channel_mentions": map[string]interface{}{ "channel_mentions": map[string]any{
"other-team": map[string]interface{}{ "other-team": map[string]any{
"display_name": "Other Team Channel", "display_name": "Other Team Channel",
}, },
}, },
@@ -816,7 +816,7 @@ func TestFillInChannelProps(t *testing.T) {
testCases := []struct { testCases := []struct {
Description string Description string
Channels model.ChannelList Channels model.ChannelList
ExpectedChannelProps map[string]interface{} ExpectedChannelProps map[string]any
}{ }{
{ {
"single channel on basic team", "single channel on basic team",
@@ -828,10 +828,10 @@ func TestFillInChannelProps(t *testing.T) {
Purpose: "~public2, ~private, ~other-team", Purpose: "~public2, ~private, ~other-team",
}, },
}, },
map[string]interface{}{ map[string]any{
"test": map[string]interface{}{ "test": map[string]any{
"channel_mentions": map[string]interface{}{ "channel_mentions": map[string]any{
"public1": map[string]interface{}{ "public1": map[string]any{
"display_name": "Public 1", "display_name": "Public 1",
}, },
}, },
@@ -860,16 +860,16 @@ func TestFillInChannelProps(t *testing.T) {
Purpose: "No references", Purpose: "No references",
}, },
}, },
map[string]interface{}{ map[string]any{
"test": map[string]interface{}{ "test": map[string]any{
"channel_mentions": map[string]interface{}{ "channel_mentions": map[string]any{
"public1": map[string]interface{}{ "public1": map[string]any{
"display_name": "Public 1", "display_name": "Public 1",
}, },
}, },
}, },
"test2": map[string]interface{}(nil), "test2": map[string]any(nil),
"test3": map[string]interface{}(nil), "test3": map[string]any(nil),
}, },
}, },
{ {
@@ -894,22 +894,22 @@ func TestFillInChannelProps(t *testing.T) {
Purpose: "No references", Purpose: "No references",
}, },
}, },
map[string]interface{}{ map[string]any{
"test": map[string]interface{}{ "test": map[string]any{
"channel_mentions": map[string]interface{}{ "channel_mentions": map[string]any{
"public1": map[string]interface{}{ "public1": map[string]any{
"display_name": "Public 1", "display_name": "Public 1",
}, },
}, },
}, },
"test2": map[string]interface{}{ "test2": map[string]any{
"channel_mentions": map[string]interface{}{ "channel_mentions": map[string]any{
"other-team": map[string]interface{}{ "other-team": map[string]any{
"display_name": "Other Team Channel", "display_name": "Other Team Channel",
}, },
}, },
}, },
"test3": map[string]interface{}(nil), "test3": map[string]any(nil),
}, },
}, },
} }

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

@@ -90,7 +90,7 @@ type Channels struct {
func init() { func init() {
RegisterProduct("channels", ProductManifest{ RegisterProduct("channels", ProductManifest{
Initializer: func(s *Server, services map[ServiceKey]interface{}) (Product, error) { Initializer: func(s *Server, services map[ServiceKey]any) (Product, error) {
return NewChannels(s, services) return NewChannels(s, services)
}, },
Dependencies: map[ServiceKey]struct{}{ Dependencies: map[ServiceKey]struct{}{
@@ -101,7 +101,7 @@ func init() {
}) })
} }
func NewChannels(s *Server, services map[ServiceKey]interface{}) (*Channels, error) { func NewChannels(s *Server, services map[ServiceKey]any) (*Channels, error) {
ch := &Channels{ ch := &Channels{
srv: s, srv: s,
imageProxy: imageproxy.MakeImageProxy(s, s.httpService, s.Log), imageProxy: imageproxy.MakeImageProxy(s, s.httpService, s.Log),

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

@@ -70,7 +70,7 @@ func (a *App) NotifySystemAdminsToUpgrade(c *request.Context, currentUserTeamID
} }
post := &model.Post{ post := &model.Post{
Message: T("api.cloud.upgrade_plan_bot_message", map[string]interface{}{"TeamName": team.Name}), Message: T("api.cloud.upgrade_plan_bot_message", map[string]any{"TeamName": team.Name}),
UserId: systemBot.UserId, UserId: systemBot.UserId,
ChannelId: channel.Id, ChannelId: channel.Id,
Type: fmt.Sprintf("%sup_notification", model.PostCustomTypePrefix), // webapp will have to create renderer for this custom post type Type: fmt.Sprintf("%sup_notification", model.PostCustomTypePrefix), // webapp will have to create renderer for this custom post type

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

@@ -42,7 +42,7 @@ func (s *clusterWrapper) PublishPluginClusterEvent(productID string, ev model.Pl
return nil return nil
} }
func (s *clusterWrapper) PublishWebSocketEvent(productID string, event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) { func (s *clusterWrapper) PublishWebSocketEvent(productID string, event string, payload map[string]any, broadcast *model.WebsocketBroadcast) {
ev := model.NewWebSocketEvent(fmt.Sprintf("custom_%v_%v", productID, event), "", "", "", nil) ev := model.NewWebSocketEvent(fmt.Sprintf("custom_%v_%v", productID, event), "", "", "", nil)
ev = ev.SetBroadcast(broadcast).SetData(payload) ev = ev.SetBroadcast(broadcast).SetData(payload)
s.srv.Publish(ev) s.srv.Publish(ev)
@@ -85,7 +85,7 @@ func (s *Server) InvokeClusterLeaderChangedListeners() {
// Fixing this would require the changed event to pass the leader directly, but that // Fixing this would require the changed event to pass the leader directly, but that
// requires a lot of work. // requires a lot of work.
s.Go(func() { s.Go(func() {
s.clusterLeaderListeners.Range(func(_, listener interface{}) bool { s.clusterLeaderListeners.Range(func(_, listener any) bool {
listener.(func())() listener.(func())()
return true return true
}) })

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

@@ -62,7 +62,7 @@ func (a *App) CreateCommandPost(c *request.Context, post *model.Post, teamID str
post.CreateAt = model.GetMillis() post.CreateAt = model.GetMillis()
if strings.HasPrefix(post.Type, model.PostSystemMessagePrefix) { if strings.HasPrefix(post.Type, model.PostSystemMessagePrefix) {
err := model.NewAppError("CreateCommandPost", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.type"}, "", http.StatusBadRequest) err := model.NewAppError("CreateCommandPost", "api.context.invalid_param.app_error", map[string]any{"Name": "post.type"}, "", http.StatusBadRequest)
return nil, err return nil, err
} }
@@ -192,7 +192,7 @@ func (a *App) ExecuteCommand(c *request.Context, args *model.CommandArgs) (*mode
} }
trigger = strings.ToLower(trigger) trigger = strings.ToLower(trigger)
if !strings.HasPrefix(trigger, "/") { if !strings.HasPrefix(trigger, "/") {
return nil, model.NewAppError("command", "api.command.execute_command.format.app_error", map[string]interface{}{"Trigger": trigger}, "", http.StatusBadRequest) return nil, model.NewAppError("command", "api.command.execute_command.format.app_error", map[string]any{"Trigger": trigger}, "", http.StatusBadRequest)
} }
trigger = strings.TrimPrefix(trigger, "/") trigger = strings.TrimPrefix(trigger, "/")
@@ -230,7 +230,7 @@ func (a *App) ExecuteCommand(c *request.Context, args *model.CommandArgs) (*mode
trigger = trigger[:maxTriggerLen] trigger = trigger[:maxTriggerLen]
trigger += "..." trigger += "..."
} }
return nil, model.NewAppError("command", "api.command.execute_command.not_found.app_error", map[string]interface{}{"Trigger": trigger}, "", http.StatusNotFound) return nil, model.NewAppError("command", "api.command.execute_command.not_found.app_error", map[string]any{"Trigger": trigger}, "", http.StatusNotFound)
} }
// MentionsToTeamMembers returns all the @ mentions found in message that // MentionsToTeamMembers returns all the @ mentions found in message that
@@ -474,7 +474,7 @@ func (a *App) tryExecuteCustomCommand(args *model.CommandArgs, trigger string, m
hook, appErr := a.CreateCommandWebhook(cmd.Id, args) hook, appErr := a.CreateCommandWebhook(cmd.Id, args)
if appErr != nil { if appErr != nil {
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": trigger}, appErr.Error(), http.StatusInternalServerError) return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]any{"Trigger": trigger}, appErr.Error(), http.StatusInternalServerError)
} }
p.Set("response_url", args.SiteURL+"/hooks/commands/"+hook.Id) p.Set("response_url", args.SiteURL+"/hooks/commands/"+hook.Id)
@@ -492,7 +492,7 @@ func (a *App) DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command
} }
if err != nil { if err != nil {
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": cmd.Trigger}, err.Error(), http.StatusInternalServerError) return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]any{"Trigger": cmd.Trigger}, err.Error(), http.StatusInternalServerError)
} }
if cmd.Method == model.CommandMethodGet { if cmd.Method == model.CommandMethodGet {
@@ -511,7 +511,7 @@ func (a *App) DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command
// Send the request // Send the request
resp, err := a.HTTPService().MakeClient(false).Do(req) resp, err := a.HTTPService().MakeClient(false).Do(req)
if err != nil { if err != nil {
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": cmd.Trigger}, err.Error(), http.StatusInternalServerError) return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]any{"Trigger": cmd.Trigger}, err.Error(), http.StatusInternalServerError)
} }
defer resp.Body.Close() defer resp.Body.Close()
@@ -523,14 +523,14 @@ func (a *App) DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command
// Ignore the error below because the resulting string will just be the empty string if bodyBytes is nil // Ignore the error below because the resulting string will just be the empty string if bodyBytes is nil
bodyBytes, _ := ioutil.ReadAll(body) bodyBytes, _ := ioutil.ReadAll(body)
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed_resp.app_error", map[string]interface{}{"Trigger": cmd.Trigger, "Status": resp.Status}, string(bodyBytes), http.StatusInternalServerError) return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed_resp.app_error", map[string]any{"Trigger": cmd.Trigger, "Status": resp.Status}, string(bodyBytes), http.StatusInternalServerError)
} }
response, err := model.CommandResponseFromHTTPBody(resp.Header.Get("Content-Type"), body) response, err := model.CommandResponseFromHTTPBody(resp.Header.Get("Content-Type"), body)
if err != nil { if err != nil {
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]interface{}{"Trigger": cmd.Trigger}, err.Error(), http.StatusInternalServerError) return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]any{"Trigger": cmd.Trigger}, err.Error(), http.StatusInternalServerError)
} else if response == nil { } else if response == nil {
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed_empty.app_error", map[string]interface{}{"Trigger": cmd.Trigger}, "", http.StatusInternalServerError) return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed_empty.app_error", map[string]any{"Trigger": cmd.Trigger}, "", http.StatusInternalServerError)
} }
return cmd, response, nil return cmd, response, nil
@@ -564,7 +564,7 @@ func (a *App) HandleCommandResponse(c *request.Context, command *model.Command,
} }
if lastError != nil { if lastError != nil {
return response, model.NewAppError("command", "api.command.execute_command.create_post_failed.app_error", map[string]interface{}{"Trigger": trigger}, "", http.StatusInternalServerError) return response, model.NewAppError("command", "api.command.execute_command.create_post_failed.app_error", map[string]any{"Trigger": trigger}, "", http.StatusInternalServerError)
} }
return response, nil return response, nil
@@ -681,7 +681,7 @@ func (a *App) GetCommand(commandID string) (*model.Command, *model.AppError) {
var nfErr *store.ErrNotFound var nfErr *store.ErrNotFound
switch { switch {
case errors.As(err, &nfErr): case errors.As(err, &nfErr):
return nil, model.NewAppError("SqlCommandStore.Get", "store.sql_command.get.missing.app_error", map[string]interface{}{"command_id": commandID}, "", http.StatusNotFound) return nil, model.NewAppError("SqlCommandStore.Get", "store.sql_command.get.missing.app_error", map[string]any{"command_id": commandID}, "", http.StatusNotFound)
default: default:
return nil, model.NewAppError("GetCommand", "app.command.getcommand.internal_error", nil, err.Error(), http.StatusInternalServerError) return nil, model.NewAppError("GetCommand", "app.command.getcommand.internal_error", nil, err.Error(), http.StatusInternalServerError)
} }
@@ -710,7 +710,7 @@ func (a *App) UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command,
var appErr *model.AppError var appErr *model.AppError
switch { switch {
case errors.As(err, &nfErr): case errors.As(err, &nfErr):
return nil, model.NewAppError("SqlCommandStore.Update", "store.sql_command.update.missing.app_error", map[string]interface{}{"command_id": updatedCmd.Id}, "", http.StatusNotFound) return nil, model.NewAppError("SqlCommandStore.Update", "store.sql_command.update.missing.app_error", map[string]any{"command_id": updatedCmd.Id}, "", http.StatusNotFound)
case errors.As(err, &appErr): case errors.As(err, &appErr):
return nil, appErr return nil, appErr
default: default:
@@ -730,7 +730,7 @@ func (a *App) MoveCommand(team *model.Team, command *model.Command) *model.AppEr
var appErr *model.AppError var appErr *model.AppError
switch { switch {
case errors.As(err, &nfErr): case errors.As(err, &nfErr):
return model.NewAppError("SqlCommandStore.Update", "store.sql_command.update.missing.app_error", map[string]interface{}{"command_id": command.Id}, "", http.StatusNotFound) return model.NewAppError("SqlCommandStore.Update", "store.sql_command.update.missing.app_error", map[string]any{"command_id": command.Id}, "", http.StatusNotFound)
case errors.As(err, &appErr): case errors.As(err, &appErr):
return appErr return appErr
default: default:
@@ -754,7 +754,7 @@ func (a *App) RegenCommandToken(cmd *model.Command) (*model.Command, *model.AppE
var appErr *model.AppError var appErr *model.AppError
switch { switch {
case errors.As(err, &nfErr): case errors.As(err, &nfErr):
return nil, model.NewAppError("SqlCommandStore.Update", "store.sql_command.update.missing.app_error", map[string]interface{}{"command_id": cmd.Id}, "", http.StatusNotFound) return nil, model.NewAppError("SqlCommandStore.Update", "store.sql_command.update.missing.app_error", map[string]any{"command_id": cmd.Id}, "", http.StatusNotFound)
case errors.As(err, &appErr): case errors.As(err, &appErr):
return nil, appErr return nil, appErr
default: default:

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

@@ -113,11 +113,11 @@ func (a *App) Config() *model.Config {
return a.ch.cfgSvc.Config() return a.ch.cfgSvc.Config()
} }
func (s *Server) EnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} { func (s *Server) EnvironmentConfig(filter func(reflect.StructField) bool) map[string]any {
return s.configStore.GetEnvironmentOverridesWithFilter(filter) return s.configStore.GetEnvironmentOverridesWithFilter(filter)
} }
func (a *App) EnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} { func (a *App) EnvironmentConfig(filter func(reflect.StructField) bool) map[string]any {
return a.Srv().EnvironmentConfig(filter) return a.Srv().EnvironmentConfig(filter)
} }
@@ -463,7 +463,7 @@ func (a *App) GetSanitizedConfig() *model.Config {
// GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable. // GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable.
// If filter is not nil and returns false for a struct field, that field will be omitted. // If filter is not nil and returns false for a struct field, that field will be omitted.
func (a *App) GetEnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} { func (a *App) GetEnvironmentConfig(filter func(reflect.StructField) bool) map[string]any {
return a.EnvironmentConfig(filter) return a.EnvironmentConfig(filter)
} }

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

@@ -31,14 +31,14 @@ func (es *Service) SendChangeUsernameEmail(newUsername, email, locale, siteURL s
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.username_change_subject", subject := T("api.templates.username_change_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, map[string]any{"SiteName": es.config().TeamSettings.SiteName,
"TeamDisplayName": es.config().TeamSettings.SiteName}) "TeamDisplayName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.username_change_body.title") data.Props["Title"] = T("api.templates.username_change_body.title")
data.Props["Info"] = T("api.templates.username_change_body.info", data.Props["Info"] = T("api.templates.username_change_body.info",
map[string]interface{}{"TeamDisplayName": es.config().TeamSettings.SiteName, "NewUsername": newUsername}) map[string]any{"TeamDisplayName": es.config().TeamSettings.SiteName, "NewUsername": newUsername})
data.Props["Warning"] = T("api.templates.email_warning") data.Props["Warning"] = T("api.templates.email_warning")
body, err := es.templatesContainer.RenderToString("email_change_body", data) body, err := es.templatesContainer.RenderToString("email_change_body", data)
@@ -59,14 +59,14 @@ func (es *Service) SendEmailChangeVerifyEmail(newUserEmail, locale, siteURL, tok
link := fmt.Sprintf("%s/do_verify_email?token=%s&email=%s", siteURL, token, url.QueryEscape(newUserEmail)) link := fmt.Sprintf("%s/do_verify_email?token=%s&email=%s", siteURL, token, url.QueryEscape(newUserEmail))
subject := T("api.templates.email_change_verify_subject", subject := T("api.templates.email_change_verify_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, map[string]any{"SiteName": es.config().TeamSettings.SiteName,
"TeamDisplayName": es.config().TeamSettings.SiteName}) "TeamDisplayName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.email_change_verify_body.title") data.Props["Title"] = T("api.templates.email_change_verify_body.title")
data.Props["Info"] = T("api.templates.email_change_verify_body.info", data.Props["Info"] = T("api.templates.email_change_verify_body.info",
map[string]interface{}{"TeamDisplayName": es.config().TeamSettings.SiteName}) map[string]any{"TeamDisplayName": es.config().TeamSettings.SiteName})
data.Props["VerifyUrl"] = link data.Props["VerifyUrl"] = link
data.Props["VerifyButton"] = T("api.templates.email_change_verify_body.button") data.Props["VerifyButton"] = T("api.templates.email_change_verify_body.button")
@@ -86,14 +86,14 @@ func (es *Service) SendEmailChangeEmail(oldEmail, newEmail, locale, siteURL stri
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.email_change_subject", subject := T("api.templates.email_change_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, map[string]any{"SiteName": es.config().TeamSettings.SiteName,
"TeamDisplayName": es.config().TeamSettings.SiteName}) "TeamDisplayName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.email_change_body.title") data.Props["Title"] = T("api.templates.email_change_body.title")
data.Props["Info"] = T("api.templates.email_change_body.info", data.Props["Info"] = T("api.templates.email_change_body.info",
map[string]interface{}{"TeamDisplayName": es.config().TeamSettings.SiteName, "NewEmail": newEmail}) map[string]any{"TeamDisplayName": es.config().TeamSettings.SiteName, "NewEmail": newEmail})
data.Props["Warning"] = T("api.templates.email_warning") data.Props["Warning"] = T("api.templates.email_warning")
body, err := es.templatesContainer.RenderToString("email_change_body", data) body, err := es.templatesContainer.RenderToString("email_change_body", data)
@@ -119,13 +119,13 @@ func (es *Service) SendVerifyEmail(userEmail, locale, siteURL, token, redirect s
serverURL := condenseSiteURL(siteURL) serverURL := condenseSiteURL(siteURL)
subject := T("api.templates.verify_subject", subject := T("api.templates.verify_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}) map[string]any{"SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.verify_body.title") data.Props["Title"] = T("api.templates.verify_body.title")
data.Props["SubTitle1"] = T("api.templates.verify_body.subTitle1") data.Props["SubTitle1"] = T("api.templates.verify_body.subTitle1")
data.Props["ServerURL"] = T("api.templates.verify_body.serverURL", map[string]interface{}{"ServerURL": serverURL}) data.Props["ServerURL"] = T("api.templates.verify_body.serverURL", map[string]any{"ServerURL": serverURL})
data.Props["SubTitle2"] = T("api.templates.verify_body.subTitle2") data.Props["SubTitle2"] = T("api.templates.verify_body.subTitle2")
data.Props["ButtonURL"] = link data.Props["ButtonURL"] = link
data.Props["Button"] = T("api.templates.verify_body.button") data.Props["Button"] = T("api.templates.verify_body.button")
@@ -150,13 +150,13 @@ func (es *Service) SendSignInChangeEmail(email, method, locale, siteURL string)
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.signin_change_email.subject", subject := T("api.templates.signin_change_email.subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}) map[string]any{"SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.signin_change_email.body.title") data.Props["Title"] = T("api.templates.signin_change_email.body.title")
data.Props["Info"] = T("api.templates.signin_change_email.body.info", data.Props["Info"] = T("api.templates.signin_change_email.body.info",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, "Method": method}) map[string]any{"SiteName": es.config().TeamSettings.SiteName, "Method": method})
data.Props["Warning"] = T("api.templates.email_warning") data.Props["Warning"] = T("api.templates.email_warning")
body, err := es.templatesContainer.RenderToString("signin_change_body", data) body, err := es.templatesContainer.RenderToString("signin_change_body", data)
@@ -184,14 +184,14 @@ func (es *Service) SendWelcomeEmail(userID string, email string, verified bool,
serverURL := condenseSiteURL(siteURL) serverURL := condenseSiteURL(siteURL)
subject := T("api.templates.welcome_subject", subject := T("api.templates.welcome_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, map[string]any{"SiteName": es.config().TeamSettings.SiteName,
"ServerURL": serverURL}) "ServerURL": serverURL})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.welcome_body.title") data.Props["Title"] = T("api.templates.welcome_body.title")
data.Props["SubTitle1"] = T("api.templates.welcome_body.subTitle1") data.Props["SubTitle1"] = T("api.templates.welcome_body.subTitle1")
data.Props["ServerURL"] = T("api.templates.welcome_body.serverURL", map[string]interface{}{"ServerURL": serverURL}) data.Props["ServerURL"] = T("api.templates.welcome_body.serverURL", map[string]any{"ServerURL": serverURL})
data.Props["SubTitle2"] = T("api.templates.welcome_body.subTitle2") data.Props["SubTitle2"] = T("api.templates.welcome_body.subTitle2")
data.Props["Button"] = T("api.templates.welcome_body.button") data.Props["Button"] = T("api.templates.welcome_body.button")
data.Props["Info"] = T("api.templates.welcome_body.info") data.Props["Info"] = T("api.templates.welcome_body.info")
@@ -235,7 +235,7 @@ func (es *Service) SendCloudUpgradeConfirmationEmail(userEmail, name, date, loca
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["Title"] = T("api.templates.cloud_upgrade_confirmation.title") data.Props["Title"] = T("api.templates.cloud_upgrade_confirmation.title")
data.Props["SubTitle"] = T("api.templates.cloud_upgrade_confirmation.subtitle", map[string]interface{}{"WorkspaceName": workspaceName, "Date": date}) data.Props["SubTitle"] = T("api.templates.cloud_upgrade_confirmation.subtitle", map[string]any{"WorkspaceName": workspaceName, "Date": date})
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["ButtonURL"] = siteURL data.Props["ButtonURL"] = siteURL
data.Props["Button"] = T("api.templates.cloud_welcome_email.button") data.Props["Button"] = T("api.templates.cloud_welcome_email.button")
@@ -269,7 +269,7 @@ func (es *Service) SendCloudWelcomeEmail(userEmail, locale, teamInviteID, workSp
data.Props["WorkSpacePath"] = siteURL data.Props["WorkSpacePath"] = siteURL
data.Props["DNS"] = dns data.Props["DNS"] = dns
data.Props["InviteInfo"] = T("api.templates.cloud_welcome_email.invite_info") data.Props["InviteInfo"] = T("api.templates.cloud_welcome_email.invite_info")
data.Props["InviteSubInfo"] = T("api.templates.cloud_welcome_email.invite_sub_info", map[string]interface{}{"WorkSpace": workSpaceName}) data.Props["InviteSubInfo"] = T("api.templates.cloud_welcome_email.invite_sub_info", map[string]any{"WorkSpace": workSpaceName})
data.Props["InviteSubInfoLink"] = fmt.Sprintf("%s/signup_user_complete/?id=%s", siteURL, teamInviteID) data.Props["InviteSubInfoLink"] = fmt.Sprintf("%s/signup_user_complete/?id=%s", siteURL, teamInviteID)
data.Props["AddAppsInfo"] = T("api.templates.cloud_welcome_email.add_apps_info") data.Props["AddAppsInfo"] = T("api.templates.cloud_welcome_email.add_apps_info")
data.Props["AddAppsSubInfo"] = T("api.templates.cloud_welcome_email.add_apps_sub_info") data.Props["AddAppsSubInfo"] = T("api.templates.cloud_welcome_email.add_apps_sub_info")
@@ -299,14 +299,14 @@ func (es *Service) SendPasswordChangeEmail(email, method, locale, siteURL string
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.password_change_subject", subject := T("api.templates.password_change_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, map[string]any{"SiteName": es.config().TeamSettings.SiteName,
"TeamDisplayName": es.config().TeamSettings.SiteName}) "TeamDisplayName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.password_change_body.title") data.Props["Title"] = T("api.templates.password_change_body.title")
data.Props["Info"] = T("api.templates.password_change_body.info", data.Props["Info"] = T("api.templates.password_change_body.info",
map[string]interface{}{"TeamDisplayName": es.config().TeamSettings.SiteName, "TeamURL": siteURL, "Method": method}) map[string]any{"TeamDisplayName": es.config().TeamSettings.SiteName, "TeamURL": siteURL, "Method": method})
data.Props["Warning"] = T("api.templates.email_warning") data.Props["Warning"] = T("api.templates.email_warning")
body, err := es.templatesContainer.RenderToString("password_change_body", data) body, err := es.templatesContainer.RenderToString("password_change_body", data)
@@ -325,13 +325,13 @@ func (es *Service) SendUserAccessTokenAddedEmail(email, locale, siteURL string)
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.user_access_token_subject", subject := T("api.templates.user_access_token_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}) map[string]any{"SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.user_access_token_body.title") data.Props["Title"] = T("api.templates.user_access_token_body.title")
data.Props["Info"] = T("api.templates.user_access_token_body.info", data.Props["Info"] = T("api.templates.user_access_token_body.info",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, "SiteURL": siteURL}) map[string]any{"SiteName": es.config().TeamSettings.SiteName, "SiteURL": siteURL})
data.Props["Warning"] = T("api.templates.email_warning") data.Props["Warning"] = T("api.templates.email_warning")
body, err := es.templatesContainer.RenderToString("password_change_body", data) body, err := es.templatesContainer.RenderToString("password_change_body", data)
@@ -352,7 +352,7 @@ func (es *Service) SendPasswordResetEmail(email string, token *model.Token, loca
link := fmt.Sprintf("%s/reset_password_complete?token=%s", siteURL, url.QueryEscape(token.Token)) link := fmt.Sprintf("%s/reset_password_complete?token=%s", siteURL, url.QueryEscape(token.Token))
subject := T("api.templates.reset_subject", subject := T("api.templates.reset_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}) map[string]any{"SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
@@ -380,16 +380,16 @@ func (es *Service) SendMfaChangeEmail(email string, activated bool, locale, site
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.mfa_change_subject", subject := T("api.templates.mfa_change_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}) map[string]any{"SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
if activated { if activated {
data.Props["Info"] = T("api.templates.mfa_activated_body.info", map[string]interface{}{"SiteURL": siteURL}) data.Props["Info"] = T("api.templates.mfa_activated_body.info", map[string]any{"SiteURL": siteURL})
data.Props["Title"] = T("api.templates.mfa_activated_body.title") data.Props["Title"] = T("api.templates.mfa_activated_body.title")
} else { } else {
data.Props["Info"] = T("api.templates.mfa_deactivated_body.info", map[string]interface{}{"SiteURL": siteURL}) data.Props["Info"] = T("api.templates.mfa_deactivated_body.info", map[string]any{"SiteURL": siteURL})
data.Props["Title"] = T("api.templates.mfa_deactivated_body.title") data.Props["Title"] = T("api.templates.mfa_deactivated_body.title")
} }
data.Props["Warning"] = T("api.templates.email_warning") data.Props["Warning"] = T("api.templates.email_warning")
@@ -424,7 +424,7 @@ func (es *Service) SendInviteEmails(team *model.Team, senderName string, senderU
for _, invite := range invites { for _, invite := range invites {
if invite != "" { if invite != "" {
subject := i18n.T("api.templates.invite_subject", subject := i18n.T("api.templates.invite_subject",
map[string]interface{}{"SenderName": senderName, map[string]any{"SenderName": senderName,
"TeamDisplayName": team.DisplayName, "TeamDisplayName": team.DisplayName,
"SiteName": es.config().TeamSettings.SiteName}) "SiteName": es.config().TeamSettings.SiteName})
@@ -447,7 +447,7 @@ func (es *Service) SendInviteEmails(team *model.Team, senderName string, senderU
tokenProps["display_name"] = team.DisplayName tokenProps["display_name"] = team.DisplayName
tokenProps["name"] = team.Name tokenProps["name"] = team.Name
title := i18n.T("api.templates.invite_body.title", map[string]interface{}{"SenderName": senderName, "TeamDisplayName": team.DisplayName}) title := i18n.T("api.templates.invite_body.title", map[string]any{"SenderName": senderName, "TeamDisplayName": team.DisplayName})
if reminderData != nil { if reminderData != nil {
reminder := i18n.T("api.templates.invite_body.title.reminder") reminder := i18n.T("api.templates.invite_body.title.reminder")
title = fmt.Sprintf("%s: %s", reminder, title) title = fmt.Sprintf("%s: %s", reminder, title)
@@ -498,13 +498,13 @@ func (es *Service) SendGuestInviteEmails(team *model.Team, channels []*model.Cha
for _, invite := range invites { for _, invite := range invites {
if invite != "" { if invite != "" {
subject := i18n.T("api.templates.invite_guest_subject", subject := i18n.T("api.templates.invite_guest_subject",
map[string]interface{}{"SenderName": senderName, map[string]any{"SenderName": senderName,
"TeamDisplayName": team.DisplayName, "TeamDisplayName": team.DisplayName,
"SiteName": es.config().TeamSettings.SiteName}) "SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData("") data := es.NewEmailTemplateData("")
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = i18n.T("api.templates.invite_body.title", map[string]interface{}{"SenderName": senderName, "TeamDisplayName": team.DisplayName}) data.Props["Title"] = i18n.T("api.templates.invite_body.title", map[string]any{"SenderName": senderName, "TeamDisplayName": team.DisplayName})
data.Props["SubTitle"] = i18n.T("api.templates.invite_body_guest.subTitle") data.Props["SubTitle"] = i18n.T("api.templates.invite_body_guest.subTitle")
data.Props["Button"] = i18n.T("api.templates.invite_body.button") data.Props["Button"] = i18n.T("api.templates.invite_body.button")
data.Props["SenderName"] = senderName data.Props["SenderName"] = senderName
@@ -610,13 +610,13 @@ func (es *Service) SendInviteEmailsToTeamAndChannels(
channelsLen := len(channels) channelsLen := len(channels)
subject := i18n.T("api.templates.invite_team_and_channels_subject", map[string]interface{}{ subject := i18n.T("api.templates.invite_team_and_channels_subject", map[string]any{
"SenderName": senderName, "SenderName": senderName,
"TeamDisplayName": team.DisplayName, "TeamDisplayName": team.DisplayName,
"ChannelsLen": channelsLen, "ChannelsLen": channelsLen,
"SiteName": es.config().TeamSettings.SiteName}) "SiteName": es.config().TeamSettings.SiteName})
title := i18n.T("api.templates.invite_team_and_channels_body.title", map[string]interface{}{ title := i18n.T("api.templates.invite_team_and_channels_body.title", map[string]any{
"SenderName": senderName, "SenderName": senderName,
"ChannelsLen": channelsLen, "ChannelsLen": channelsLen,
"TeamDisplayName": team.DisplayName}) "TeamDisplayName": team.DisplayName})
@@ -625,13 +625,13 @@ func (es *Service) SendInviteEmailsToTeamAndChannels(
channelName := channels[0].DisplayName channelName := channels[0].DisplayName
subject = i18n.T("api.templates.invite_team_and_channel_subject", subject = i18n.T("api.templates.invite_team_and_channel_subject",
map[string]interface{}{"SenderName": senderName, map[string]any{"SenderName": senderName,
"TeamDisplayName": team.DisplayName, "TeamDisplayName": team.DisplayName,
"ChannelName": channelName, "ChannelName": channelName,
"SiteName": es.config().TeamSettings.SiteName}, "SiteName": es.config().TeamSettings.SiteName},
) )
title = i18n.T("api.templates.invite_team_and_channel_body.title", map[string]interface{}{ title = i18n.T("api.templates.invite_team_and_channel_body.title", map[string]any{
"SenderName": senderName, "SenderName": senderName,
"ChannelName": channelName, "ChannelName": channelName,
"TeamDisplayName": team.DisplayName, "TeamDisplayName": team.DisplayName,
@@ -743,11 +743,11 @@ func (es *Service) NewEmailTemplateData(locale string) templates.Data {
} }
return templates.Data{ return templates.Data{
Props: map[string]interface{}{ Props: map[string]any{
"EmailInfo1": localT("api.templates.email_info1"), "EmailInfo1": localT("api.templates.email_info1"),
"EmailInfo2": localT("api.templates.email_info2"), "EmailInfo2": localT("api.templates.email_info2"),
"EmailInfo3": localT("api.templates.email_info3", "EmailInfo3": localT("api.templates.email_info3",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}), map[string]any{"SiteName": es.config().TeamSettings.SiteName}),
"SupportEmail": *es.config().SupportSettings.SupportEmail, "SupportEmail": *es.config().SupportSettings.SupportEmail,
"Footer": localT("api.templates.email_footer"), "Footer": localT("api.templates.email_footer"),
"FooterV2": localT("api.templates.email_footer_v2"), "FooterV2": localT("api.templates.email_footer_v2"),
@@ -763,14 +763,14 @@ func (es *Service) SendDeactivateAccountEmail(email string, locale, siteURL stri
serverURL := condenseSiteURL(siteURL) serverURL := condenseSiteURL(siteURL)
subject := T("api.templates.deactivate_subject", subject := T("api.templates.deactivate_subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName, map[string]any{"SiteName": es.config().TeamSettings.SiteName,
"ServerURL": serverURL}) "ServerURL": serverURL})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.deactivate_body.title", map[string]interface{}{"ServerURL": serverURL}) data.Props["Title"] = T("api.templates.deactivate_body.title", map[string]any{"ServerURL": serverURL})
data.Props["Info"] = T("api.templates.deactivate_body.info", data.Props["Info"] = T("api.templates.deactivate_body.info",
map[string]interface{}{"SiteURL": siteURL}) map[string]any{"SiteURL": siteURL})
data.Props["Warning"] = T("api.templates.deactivate_body.warning") data.Props["Warning"] = T("api.templates.deactivate_body.warning")
body, err := es.templatesContainer.RenderToString("deactivate_body", data) body, err := es.templatesContainer.RenderToString("deactivate_body", data)
@@ -879,7 +879,7 @@ func (es *Service) SendLicenseInactivityEmail(email, name, locale, siteURL strin
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.server_inactivity_title") data.Props["Title"] = T("api.templates.server_inactivity_title")
data.Props["SubTitle"] = T("api.templates.server_inactivity_subtitle", map[string]interface{}{"Name": name}) data.Props["SubTitle"] = T("api.templates.server_inactivity_subtitle", map[string]any{"Name": name})
data.Props["InfoBullet"] = T("api.templates.server_inactivity_info_bullet") data.Props["InfoBullet"] = T("api.templates.server_inactivity_info_bullet")
data.Props["InfoBullet1"] = T("api.templates.server_inactivity_info_bullet1") data.Props["InfoBullet1"] = T("api.templates.server_inactivity_info_bullet1")
data.Props["InfoBullet2"] = T("api.templates.server_inactivity_info_bullet2") data.Props["InfoBullet2"] = T("api.templates.server_inactivity_info_bullet2")
@@ -901,7 +901,7 @@ func (es *Service) SendLicenseInactivityEmail(email, name, locale, siteURL strin
inactivityDurationHours = serverInactivityHours inactivityDurationHours = serverInactivityHours
} }
data.Props["FooterDisclaimer"] = T("api.templates.server_inactivity_footer_disclaimer", map[string]interface{}{"Hours": inactivityDurationHours}) data.Props["FooterDisclaimer"] = T("api.templates.server_inactivity_footer_disclaimer", map[string]any{"Hours": inactivityDurationHours})
body, err := es.templatesContainer.RenderToString("inactivity_body", data) body, err := es.templatesContainer.RenderToString("inactivity_body", data)
if err != nil { if err != nil {
@@ -922,7 +922,7 @@ func (es *Service) SendLicenseUpForRenewalEmail(email, name, locale, siteURL, re
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.license_up_for_renewal_title") data.Props["Title"] = T("api.templates.license_up_for_renewal_title")
data.Props["SubTitle"] = T("api.templates.license_up_for_renewal_subtitle", map[string]interface{}{"UserName": name, "Days": daysToExpiration}) data.Props["SubTitle"] = T("api.templates.license_up_for_renewal_subtitle", map[string]any{"UserName": name, "Days": daysToExpiration})
data.Props["SubTitleTwo"] = T("api.templates.license_up_for_renewal_subtitle_two") data.Props["SubTitleTwo"] = T("api.templates.license_up_for_renewal_subtitle_two")
data.Props["EmailUs"] = T("api.templates.email_us_anytime_at") data.Props["EmailUs"] = T("api.templates.email_us_anytime_at")
data.Props["Button"] = T("api.templates.license_up_for_renewal_renew_now") data.Props["Button"] = T("api.templates.license_up_for_renewal_renew_now")
@@ -951,7 +951,7 @@ func (es *Service) SendPaymentFailedEmail(email string, locale string, failedPay
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL
data.Props["Title"] = T("api.templates.payment_failed.title") data.Props["Title"] = T("api.templates.payment_failed.title")
data.Props["Info1"] = T("api.templates.payment_failed.info1", map[string]interface{}{"CardBrand": failedPayment.CardBrand, "LastFour": failedPayment.LastFour}) data.Props["Info1"] = T("api.templates.payment_failed.info1", map[string]any{"CardBrand": failedPayment.CardBrand, "LastFour": failedPayment.LastFour})
data.Props["Info2"] = T("api.templates.payment_failed.info2") data.Props["Info2"] = T("api.templates.payment_failed.info2")
data.Props["Info3"] = T("api.templates.payment_failed.info3") data.Props["Info3"] = T("api.templates.payment_failed.info3")
data.Props["Button"] = T("api.templates.over_limit_fix_now") data.Props["Button"] = T("api.templates.over_limit_fix_now")
@@ -1005,7 +1005,7 @@ func (es *Service) SendNoCardPaymentFailedEmail(email string, locale string, sit
func (es *Service) SendRemoveExpiredLicenseEmail(renewalLink, email string, locale, siteURL string) error { func (es *Service) SendRemoveExpiredLicenseEmail(renewalLink, email string, locale, siteURL string) error {
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
subject := T("api.templates.remove_expired_license.subject", subject := T("api.templates.remove_expired_license.subject",
map[string]interface{}{"SiteName": es.config().TeamSettings.SiteName}) map[string]any{"SiteName": es.config().TeamSettings.SiteName})
data := es.NewEmailTemplateData(locale) data := es.NewEmailTemplateData(locale)
data.Props["SiteURL"] = siteURL data.Props["SiteURL"] = siteURL

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

@@ -276,7 +276,7 @@ func (es *Service) sendBatchedEmailNotification(userID string, notifications []*
tm := time.Unix(notification.post.CreateAt/1000, 0) tm := time.Unix(notification.post.CreateAt/1000, 0)
timezone, _ := tm.Zone() timezone, _ := tm.Zone()
t := translateFunc("api.email_batching.send_batched_email_notification.time", map[string]interface{}{ t := translateFunc("api.email_batching.send_batched_email_notification.time", map[string]any{
"Hour": tm.Hour(), "Hour": tm.Hour(),
"Minute": fmt.Sprintf("%02d", tm.Minute()), "Minute": fmt.Sprintf("%02d", tm.Minute()),
"Month": translateFunc(tm.Month().String()), "Month": translateFunc(tm.Month().String()),
@@ -292,7 +292,7 @@ func (es *Service) sendBatchedEmailNotification(userID string, notifications []*
otherChannelMembersCount := 0 otherChannelMembersCount := 0
if threadsEnabled && notification.post.RootId != "" { if threadsEnabled && notification.post.RootId != "" {
props := map[string]interface{}{"channelName": channelDisplayName} props := map[string]any{"channelName": channelDisplayName}
channelDisplayName = translateFunc("api.push_notification.title.collapsed_threads", props) channelDisplayName = translateFunc("api.push_notification.title.collapsed_threads", props)
if channel.Type == model.ChannelTypeDirect { if channel.Type == model.ChannelTypeDirect {
channelDisplayName = translateFunc("api.push_notification.title.collapsed_threads_dm") channelDisplayName = translateFunc("api.push_notification.title.collapsed_threads_dm")
@@ -320,7 +320,7 @@ func (es *Service) sendBatchedEmailNotification(userID string, notifications []*
tm := time.Unix(notifications[0].post.CreateAt/1000, 0) tm := time.Unix(notifications[0].post.CreateAt/1000, 0)
subject := translateFunc("api.email_batching.send_batched_email_notification.subject", len(notifications), map[string]interface{}{ subject := translateFunc("api.email_batching.send_batched_email_notification.subject", len(notifications), map[string]any{
"SiteName": es.config().TeamSettings.SiteName, "SiteName": es.config().TeamSettings.SiteName,
"Year": tm.Year(), "Year": tm.Year(),
"Month": translateFunc(tm.Month().String()), "Month": translateFunc(tm.Month().String()),

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

@@ -37,7 +37,7 @@ func (es *Service) GetMessageForNotification(post *model.Post, translateFunc i18
onlyImages = onlyImages && info.IsImage() onlyImages = onlyImages && info.IsImage()
} }
props := map[string]interface{}{"Filenames": strings.Join(filenames, ", ")} props := map[string]any{"Filenames": strings.Join(filenames, ", ")}
if onlyImages { if onlyImages {
return translateFunc("api.post.get_message_for_notification.images_sent", len(filenames), props) return translateFunc("api.post.get_message_for_notification.images_sent", len(filenames), props)

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

@@ -66,7 +66,7 @@ func (a *App) CreateEmoji(sessionUserId string, emoji *model.Emoji, multiPartIma
imageData := multiPartImageData.File["image"] imageData := multiPartImageData.File["image"]
if len(imageData) == 0 { if len(imageData) == 0 {
err := model.NewAppError("Context", "api.context.invalid_body_param.app_error", map[string]interface{}{"Name": "createEmoji"}, "", http.StatusBadRequest) err := model.NewAppError("Context", "api.context.invalid_body_param.app_error", map[string]any{"Name": "createEmoji"}, "", http.StatusBadRequest)
return nil, err return nil, err
} }
@@ -123,7 +123,7 @@ func (a *App) UploadEmojiImage(id string, imageData *multipart.FileHeader) *mode
} }
if config.Width > MaxEmojiOriginalWidth || config.Height > MaxEmojiOriginalHeight { if config.Width > MaxEmojiOriginalWidth || config.Height > MaxEmojiOriginalHeight {
return model.NewAppError("uploadEmojiImage", "api.emoji.upload.large_image.too_large.app_error", map[string]interface{}{ return model.NewAppError("uploadEmojiImage", "api.emoji.upload.large_image.too_large.app_error", map[string]any{
"MaxWidth": MaxEmojiOriginalWidth, "MaxWidth": MaxEmojiOriginalWidth,
"MaxHeight": MaxEmojiOriginalHeight, "MaxHeight": MaxEmojiOriginalHeight,
}, "", http.StatusBadRequest) }, "", http.StatusBadRequest)

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

@@ -79,7 +79,7 @@ func (a *App) getSessionExpiredPushMessage(session *model.Session) string {
T := i18n.GetUserTranslations(locale) T := i18n.GetUserTranslations(locale)
siteName := *a.Config().TeamSettings.SiteName siteName := *a.Config().TeamSettings.SiteName
props := map[string]interface{}{"siteName": siteName, "hoursCount": *a.Config().ServiceSettings.SessionLengthMobileInHours} props := map[string]any{"siteName": siteName, "hoursCount": *a.Config().ServiceSettings.SessionLengthMobileInHours}
return T("api.push_notifications.session.expired", props) return T("api.push_notifications.session.expired", props)
} }

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

@@ -496,7 +496,7 @@ func TestExportPostWithProps(t *testing.T) {
p1 := &model.Post{ p1 := &model.Post{
ChannelId: dmChannel.Id, ChannelId: dmChannel.Id,
Message: "aa" + model.NewId() + "a", Message: "aa" + model.NewId() + "a",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": attachments, "attachments": attachments,
}, },
UserId: th1.BasicUser.Id, UserId: th1.BasicUser.Id,
@@ -506,7 +506,7 @@ func TestExportPostWithProps(t *testing.T) {
p2 := &model.Post{ p2 := &model.Post{
ChannelId: gmChannel.Id, ChannelId: gmChannel.Id,
Message: "dd" + model.NewId() + "a", Message: "dd" + model.NewId() + "a",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": attachments, "attachments": attachments,
}, },
UserId: th1.BasicUser.Id, UserId: th1.BasicUser.Id,
@@ -545,8 +545,8 @@ func TestExportPostWithProps(t *testing.T) {
assert.Len(t, posts, 2) assert.Len(t, posts, 2)
assert.ElementsMatch(t, gmMembers, *posts[0].ChannelMembers) assert.ElementsMatch(t, gmMembers, *posts[0].ChannelMembers)
assert.ElementsMatch(t, dmMembers, *posts[1].ChannelMembers) assert.ElementsMatch(t, dmMembers, *posts[1].ChannelMembers)
assert.Contains(t, posts[0].Props["attachments"].([]interface{})[0], "footer") assert.Contains(t, posts[0].Props["attachments"].([]any)[0], "footer")
assert.Contains(t, posts[1].Props["attachments"].([]interface{})[0], "footer") assert.Contains(t, posts[1].Props["attachments"].([]any)[0], "footer")
} }
func TestExportDMPostWithSelf(t *testing.T) { func TestExportDMPostWithSelf(t *testing.T) {

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

@@ -61,7 +61,7 @@ func (s *Server) startFeatureFlagUpdateJob() error {
log = s.Log log = s.Log
} }
attributes := map[string]interface{}{} attributes := map[string]any{}
// if we are part of a cloud installation, add its installation and group id // if we are part of a cloud installation, add its installation and group id
if installationId := os.Getenv("MM_CLOUD_INSTALLATION_ID"); installationId != "" { if installationId := os.Getenv("MM_CLOUD_INSTALLATION_ID"); installationId != "" {

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

@@ -22,7 +22,7 @@ type SyncParams struct {
SplitKey string SplitKey string
SyncIntervalSeconds int SyncIntervalSeconds int
Log *mlog.Logger Log *mlog.Logger
Attributes map[string]interface{} Attributes map[string]any
} }
type Synchronizer struct { type Synchronizer struct {
@@ -100,7 +100,7 @@ func featureFlagsFromMap(featuresMap map[string]string, baseFeatureFlags model.F
return baseFeatureFlags return baseFeatureFlags
} }
func getStructFields(s interface{}) []string { func getStructFields(s any) []string {
structType := reflect.TypeOf(s) structType := reflect.TypeOf(s)
fieldNames := make([]string, 0, structType.NumField()) fieldNames := make([]string, 0, structType.NumField())
for i := 0; i < structType.NumField(); i++ { for i := 0; i < structType.NumField(); i++ {

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

@@ -13,23 +13,23 @@ type splitLogger struct {
wrappedLog *mlog.Logger wrappedLog *mlog.Logger
} }
func (s *splitLogger) Error(msg ...interface{}) { func (s *splitLogger) Error(msg ...any) {
s.wrappedLog.Error(fmt.Sprint(msg...)) s.wrappedLog.Error(fmt.Sprint(msg...))
} }
func (s *splitLogger) Warning(msg ...interface{}) { func (s *splitLogger) Warning(msg ...any) {
s.wrappedLog.Warn(fmt.Sprint(msg...)) s.wrappedLog.Warn(fmt.Sprint(msg...))
} }
// Ignoring more verbose messages from split // Ignoring more verbose messages from split
func (s *splitLogger) Info(msg ...interface{}) { func (s *splitLogger) Info(msg ...any) {
//s.wrappedLog.Info(fmt.Sprint(msg...)) //s.wrappedLog.Info(fmt.Sprint(msg...))
} }
func (s *splitLogger) Debug(msg ...interface{}) { func (s *splitLogger) Debug(msg ...any) {
//s.wrappedLog.Debug(fmt.Sprint(msg...)) //s.wrappedLog.Debug(fmt.Sprint(msg...))
} }
func (s *splitLogger) Verbose(msg ...interface{}) { func (s *splitLogger) Verbose(msg ...any) {
//s.wrappedLog.Info(fmt.Sprint(msg...)) //s.wrappedLog.Info(fmt.Sprint(msg...))
} }

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

@@ -456,7 +456,7 @@ func (a *App) UploadMultipartFiles(c *request.Context, teamID string, channelID
file, fileErr := fileHeader.Open() file, fileErr := fileHeader.Open()
if fileErr != nil { if fileErr != nil {
return nil, model.NewAppError("UploadFiles", "api.file.upload_file.read_request.app_error", return nil, model.NewAppError("UploadFiles", "api.file.upload_file.read_request.app_error",
map[string]interface{}{"Filename": fileHeader.Filename}, fileErr.Error(), http.StatusBadRequest) map[string]any{"Filename": fileHeader.Filename}, fileErr.Error(), http.StatusBadRequest)
} }
// Will be closed after UploadFiles returns // Will be closed after UploadFiles returns
@@ -523,7 +523,7 @@ func (a *App) UploadFile(c *request.Context, data []byte, channelID string, file
_, err := a.GetChannel(channelID) _, err := a.GetChannel(channelID)
if err != nil && channelID != "" { if err != nil && channelID != "" {
return nil, model.NewAppError("UploadFile", "api.file.upload_file.incorrect_channelId.app_error", return nil, model.NewAppError("UploadFile", "api.file.upload_file.incorrect_channelId.app_error",
map[string]interface{}{"channelId": channelID}, "", http.StatusBadRequest) map[string]any{"channelId": channelID}, "", http.StatusBadRequest)
} }
info, _, appError := a.DoUploadFileExpectModification(c, time.Now(), "noteam", channelID, "nouser", filename, data) info, _, appError := a.DoUploadFileExpectModification(c, time.Now(), "noteam", channelID, "nouser", filename, data)
@@ -898,8 +898,8 @@ func (t UploadFileTask) pathPrefix() string {
"/" + t.fileinfo.Id + "/" "/" + t.fileinfo.Id + "/"
} }
func (t UploadFileTask) newAppError(id string, httpStatus int, extra ...interface{}) *model.AppError { func (t UploadFileTask) newAppError(id string, httpStatus int, extra ...any) *model.AppError {
params := map[string]interface{}{ params := map[string]any{
"Name": t.Name, "Name": t.Name,
"Filename": t.Name, "Filename": t.Name,
"ChannelId": t.ChannelId, "ChannelId": t.ChannelId,
@@ -948,7 +948,7 @@ func (a *App) DoUploadFileExpectModification(c *request.Context, now time.Time,
if info.IsImage() && !info.IsSvg() { if info.IsImage() && !info.IsSvg() {
if limitErr := checkImageResolutionLimit(info.Width, info.Height, *a.Config().FileSettings.MaxImageResolution); limitErr != nil { if limitErr := checkImageResolutionLimit(info.Width, info.Height, *a.Config().FileSettings.MaxImageResolution); limitErr != nil {
err := model.NewAppError("uploadFile", "api.file.upload_file.large_image.app_error", map[string]interface{}{"Filename": filename}, limitErr.Error(), http.StatusBadRequest) err := model.NewAppError("uploadFile", "api.file.upload_file.large_image.app_error", map[string]any{"Filename": filename}, limitErr.Error(), http.StatusBadRequest)
return nil, data, err return nil, data, err
} }

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

@@ -314,7 +314,7 @@ func (a *App) importLine(c *request.Context, line LineImportData, dryRun bool) *
} }
return a.importEmoji(line.Emoji, dryRun) return a.importEmoji(line.Emoji, dryRun)
default: default:
return model.NewAppError("BulkImport", "app.import.import_line.unknown_line_type.error", map[string]interface{}{"Type": line.Type}, "", http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.import_line.unknown_line_type.error", map[string]any{"Type": line.Type}, "", http.StatusBadRequest)
} }
} }

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

@@ -45,7 +45,7 @@ func (a *App) importScheme(data *SchemeImportData, dryRun bool) *model.AppError
if err != nil { if err != nil {
scheme = new(model.Scheme) scheme = new(model.Scheme)
} else if scheme.Scope != *data.Scope { } else if scheme.Scope != *data.Scope {
return model.NewAppError("BulkImport", "app.import.import_scheme.scope_change.error", map[string]interface{}{"SchemeName": scheme.Name}, "", http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.import_scheme.scope_change.error", map[string]any{"SchemeName": scheme.Name}, "", http.StatusBadRequest)
} }
scheme.Name = *data.Name scheme.Name = *data.Name
@@ -239,7 +239,7 @@ func (a *App) importChannel(c *request.Context, data *ChannelImportData, dryRun
team, err := a.Srv().Store.Team().GetByName(*data.Team) team, err := a.Srv().Store.Team().GetByName(*data.Team)
if err != nil { if err != nil {
return model.NewAppError("BulkImport", "app.import.import_channel.team_not_found.error", map[string]interface{}{"TeamName": *data.Team}, err.Error(), http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.import_channel.team_not_found.error", map[string]any{"TeamName": *data.Team}, err.Error(), http.StatusBadRequest)
} }
var channel *model.Channel var channel *model.Channel
@@ -1068,7 +1068,7 @@ func (a *App) importReaction(data *ReactionImportData, post *model.Post) *model.
var user *model.User var user *model.User
var nErr error var nErr error
if user, nErr = a.Srv().Store.User().GetByUsername(*data.User); nErr != nil { if user, nErr = a.Srv().Store.User().GetByUsername(*data.User); nErr != nil {
return model.NewAppError("BulkImport", "app.import.import_post.user_not_found.error", map[string]interface{}{"Username": data.User}, nErr.Error(), http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.import_post.user_not_found.error", map[string]any{"Username": data.User}, nErr.Error(), http.StatusBadRequest)
} }
reaction := &model.Reaction{ reaction := &model.Reaction{
@@ -1200,7 +1200,7 @@ func (a *App) importAttachment(c *request.Context, data *AttachmentImportData, p
if data.Data != nil { if data.Data != nil {
zipFile, err := data.Data.Open() zipFile, err := data.Data.Open()
if err != nil { if err != nil {
return nil, model.NewAppError("BulkImport", "app.import.attachment.bad_file.error", map[string]interface{}{"FilePath": *data.Path}, err.Error(), http.StatusBadRequest) return nil, model.NewAppError("BulkImport", "app.import.attachment.bad_file.error", map[string]any{"FilePath": *data.Path}, err.Error(), http.StatusBadRequest)
} }
defer zipFile.Close() defer zipFile.Close()
name = data.Data.Name name = data.Data.Name
@@ -1208,7 +1208,7 @@ func (a *App) importAttachment(c *request.Context, data *AttachmentImportData, p
} else { } else {
realFile, err := os.Open(*data.Path) realFile, err := os.Open(*data.Path)
if err != nil { if err != nil {
return nil, model.NewAppError("BulkImport", "app.import.attachment.bad_file.error", map[string]interface{}{"FilePath": *data.Path}, err.Error(), http.StatusBadRequest) return nil, model.NewAppError("BulkImport", "app.import.attachment.bad_file.error", map[string]any{"FilePath": *data.Path}, err.Error(), http.StatusBadRequest)
} }
defer realFile.Close() defer realFile.Close()
name = realFile.Name() name = realFile.Name()
@@ -1219,14 +1219,14 @@ func (a *App) importAttachment(c *request.Context, data *AttachmentImportData, p
fileData, err := ioutil.ReadAll(file) fileData, err := ioutil.ReadAll(file)
if err != nil { if err != nil {
return nil, model.NewAppError("BulkImport", "app.import.attachment.read_file_data.error", map[string]interface{}{"FilePath": *data.Path}, "", http.StatusBadRequest) return nil, model.NewAppError("BulkImport", "app.import.attachment.read_file_data.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest)
} }
// Go over existing files in the post and see if there already exists a file with the same name, size and hash. If so - skip it // Go over existing files in the post and see if there already exists a file with the same name, size and hash. If so - skip it
if post.Id != "" { if post.Id != "" {
oldFiles, err := a.GetFileInfosForPost(post.Id, true) oldFiles, err := a.GetFileInfosForPost(post.Id, true)
if err != nil { if err != nil {
return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]interface{}{"FilePath": *data.Path}, "", http.StatusBadRequest) return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest)
} }
for _, oldFile := range oldFiles { for _, oldFile := range oldFiles {
if oldFile.Name != path.Base(name) || oldFile.Size != int64(len(fileData)) { if oldFile.Name != path.Base(name) || oldFile.Size != int64(len(fileData)) {
@@ -1236,7 +1236,7 @@ func (a *App) importAttachment(c *request.Context, data *AttachmentImportData, p
newHash := sha1.Sum(fileData) newHash := sha1.Sum(fileData)
oldFileData, err := a.GetFile(oldFile.Id) oldFileData, err := a.GetFile(oldFile.Id)
if err != nil { if err != nil {
return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]interface{}{"FilePath": *data.Path}, "", http.StatusBadRequest) return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest)
} }
oldHash := sha1.Sum(oldFileData) oldHash := sha1.Sum(oldFileData)
@@ -1327,7 +1327,7 @@ func (a *App) getChannelsForPosts(teams map[string]*model.Team, data []*PostImpo
var err error var err error
channel, err = a.Srv().Store.Channel().GetByName(teams[teamName].Id, *postData.Channel, true) channel, err = a.Srv().Store.Channel().GetByName(teams[teamName].Id, *postData.Channel, true)
if err != nil { if err != nil {
return nil, model.NewAppError("BulkImport", "app.import.import_post.channel_not_found.error", map[string]interface{}{"ChannelName": *postData.Channel}, err.Error(), http.StatusBadRequest) return nil, model.NewAppError("BulkImport", "app.import.import_post.channel_not_found.error", map[string]any{"ChannelName": *postData.Channel}, err.Error(), http.StatusBadRequest)
} }
teamChannels[teamName][*postData.Channel] = channel teamChannels[teamName][*postData.Channel] = channel
} }
@@ -1881,7 +1881,7 @@ func (a *App) importEmoji(data *EmojiImportData, dryRun bool) *model.AppError {
file, err = os.Open(*data.Image) file, err = os.Open(*data.Image)
} }
if err != nil { if err != nil {
return model.NewAppError("BulkImport", "app.import.emoji.bad_file.error", map[string]interface{}{"EmojiName": *data.Name}, "", http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.emoji.bad_file.error", map[string]any{"EmojiName": *data.Name}, "", http.StatusBadRequest)
} }
defer file.Close() defer file.Close()

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

@@ -492,7 +492,7 @@ func validateDirectChannelImportData(data *DirectChannelImportData) *model.AppEr
} }
} }
if !found { if !found {
return model.NewAppError("BulkImport", "app.import.validate_direct_channel_import_data.unknown_favoriter.error", map[string]interface{}{"Username": favoriter}, "", http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.validate_direct_channel_import_data.unknown_favoriter.error", map[string]any{"Username": favoriter}, "", http.StatusBadRequest)
} }
} }
} }
@@ -539,7 +539,7 @@ func validateDirectPostImportData(data *DirectPostImportData, maxPostSize int) *
} }
} }
if !found { if !found {
return model.NewAppError("BulkImport", "app.import.validate_direct_post_import_data.unknown_flagger.error", map[string]interface{}{"Username": flagger}, "", http.StatusBadRequest) return model.NewAppError("BulkImport", "app.import.validate_direct_post_import_data.unknown_flagger.error", map[string]any{"Username": flagger}, "", http.StatusBadRequest)
} }
} }
} }

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

@@ -51,7 +51,7 @@ func (a *App) DoPostActionWithCookie(c *request.Context, postID, actionId, userI
// IsPinned and HasReaction attributes, and preserve its entire // IsPinned and HasReaction attributes, and preserve its entire
// original Props set unless the plugin returns a replacement value. // original Props set unless the plugin returns a replacement value.
// originalXxx variables are used to preserve these values. // originalXxx variables are used to preserve these values.
var originalProps map[string]interface{} var originalProps map[string]any
originalIsPinned := false originalIsPinned := false
originalHasReactions := false originalHasReactions := false
@@ -59,7 +59,7 @@ func (a *App) DoPostActionWithCookie(c *request.Context, postID, actionId, userI
// need to preserve some original values, as listed in // need to preserve some original values, as listed in
// model.PostActionRetainPropKeys. remove and retain track these. // model.PostActionRetainPropKeys. remove and retain track these.
remove := []string{} remove := []string{}
retain := map[string]interface{}{} retain := map[string]any{}
datasource := "" datasource := ""
upstreamURL := "" upstreamURL := ""
@@ -222,7 +222,7 @@ func (a *App) DoPostActionWithCookie(c *request.Context, postID, actionId, userI
if upstreamRequest.Type == model.PostActionTypeSelect { if upstreamRequest.Type == model.PostActionTypeSelect {
if selectedOption != "" { if selectedOption != "" {
if upstreamRequest.Context == nil { if upstreamRequest.Context == nil {
upstreamRequest.Context = map[string]interface{}{} upstreamRequest.Context = map[string]any{}
} }
upstreamRequest.DataSource = datasource upstreamRequest.DataSource = datasource
upstreamRequest.Context["selected_option"] = selectedOption upstreamRequest.Context["selected_option"] = selectedOption
@@ -548,23 +548,23 @@ func (a *App) buildWarnMetricMailtoLink(warnMetricId string, user *model.User) s
_, warnMetricDisplayTexts := a.getWarnMetricStatusAndDisplayTextsForId(warnMetricId, T, false) _, warnMetricDisplayTexts := a.getWarnMetricStatusAndDisplayTextsForId(warnMetricId, T, false)
mailBody := warnMetricDisplayTexts.EmailBody mailBody := warnMetricDisplayTexts.EmailBody
mailBody += T("api.server.warn_metric.bot_response.mailto_contact_header", map[string]interface{}{"Contact": user.GetFullName()}) mailBody += T("api.server.warn_metric.bot_response.mailto_contact_header", map[string]any{"Contact": user.GetFullName()})
mailBody += "\r\n" mailBody += "\r\n"
mailBody += T("api.server.warn_metric.bot_response.mailto_email_header", map[string]interface{}{"Email": user.Email}) mailBody += T("api.server.warn_metric.bot_response.mailto_email_header", map[string]any{"Email": user.Email})
mailBody += "\r\n" mailBody += "\r\n"
registeredUsersCount, err := a.Srv().Store.User().Count(model.UserCountOptions{}) registeredUsersCount, err := a.Srv().Store.User().Count(model.UserCountOptions{})
if err != nil { if err != nil {
mlog.Warn("Error retrieving the number of registered users", mlog.Err(err)) mlog.Warn("Error retrieving the number of registered users", mlog.Err(err))
} else { } else {
mailBody += i18n.T("api.server.warn_metric.bot_response.mailto_registered_users_header", map[string]interface{}{"NoRegisteredUsers": registeredUsersCount}) mailBody += i18n.T("api.server.warn_metric.bot_response.mailto_registered_users_header", map[string]any{"NoRegisteredUsers": registeredUsersCount})
mailBody += "\r\n" mailBody += "\r\n"
} }
mailBody += T("api.server.warn_metric.bot_response.mailto_site_url_header", map[string]interface{}{"SiteUrl": a.GetSiteURL()}) mailBody += T("api.server.warn_metric.bot_response.mailto_site_url_header", map[string]any{"SiteUrl": a.GetSiteURL()})
mailBody += "\r\n" mailBody += "\r\n"
mailBody += T("api.server.warn_metric.bot_response.mailto_diagnostic_id_header", map[string]interface{}{"DiagnosticId": a.TelemetryId()}) mailBody += T("api.server.warn_metric.bot_response.mailto_diagnostic_id_header", map[string]any{"DiagnosticId": a.TelemetryId()})
mailBody += "\r\n" mailBody += "\r\n"
mailBody += T("api.server.warn_metric.bot_response.mailto_footer") mailBody += T("api.server.warn_metric.bot_response.mailto_footer")

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

@@ -501,7 +501,7 @@ func TestSubmitInteractiveDialog(t *testing.T) {
TeamId: th.BasicTeam.Id, TeamId: th.BasicTeam.Id,
CallbackId: "someid", CallbackId: "someid",
State: "somestate", State: "somestate",
Submission: map[string]interface{}{ Submission: map[string]any{
"name1": "value1", "name1": "value1",
}, },
} }

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

@@ -106,7 +106,7 @@ func (a *App) checkIfIntegrationsMeetFreemiumLimits(originalPluginIds []string)
limit := *limits.Integrations.Enabled limit := *limits.Integrations.Enabled
if enableCount > limit { if enableCount > limit {
return model.NewAppError("checkIfIntegrationMeetsFreemiumLimits", "app.install_integration.reached_max_limit.error", map[string]interface{}{"NumIntegrations": limit}, "", http.StatusBadRequest) return model.NewAppError("checkIfIntegrationMeetsFreemiumLimits", "app.install_integration.reached_max_limit.error", map[string]any{"NumIntegrations": limit}, "", http.StatusBadRequest)
} }
return nil return nil

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

@@ -85,7 +85,7 @@ func fixTypeName(t string) string {
if t == "...func(*UploadFileTask)" { if t == "...func(*UploadFileTask)" {
t = "...func(*app.UploadFileTask)" t = "...func(*app.UploadFileTask)"
} }
if strings.Contains(t, ".") || strings.Contains(t, "{}") { if strings.Contains(t, ".") || strings.Contains(t, "{}") || t == "map[string]any" {
return t return t
} }
typeOnly := textRegexp.FindString(t) typeOnly := textRegexp.FindString(t)

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

@@ -55,7 +55,7 @@ func (a *App) GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError) {
return nil, err return nil, err
} }
} else { } else {
ae := model.NewAppError("GetLdapGroup", "ent.ldap.app_error", map[string]interface{}{"ldap_group_id": ldapGroupID}, "", http.StatusNotImplemented) ae := model.NewAppError("GetLdapGroup", "ent.ldap.app_error", map[string]any{"ldap_group_id": ldapGroupID}, "", http.StatusNotImplemented)
return nil, ae return nil, ae
} }
@@ -235,7 +235,7 @@ func (a *App) AddLdapPrivateCertificate(fileData *multipart.FileHeader) *model.A
func (a *App) removeLdapFile(filename string) *model.AppError { func (a *App) removeLdapFile(filename string) *model.AppError {
if err := a.Srv().configStore.RemoveFile(filename); err != nil { if err := a.Srv().configStore.RemoveFile(filename); err != nil {
return model.NewAppError("RemoveLdapFile", "api.admin.remove_certificate.delete.app_error", map[string]interface{}{"Filename": filename}, err.Error(), http.StatusInternalServerError) return model.NewAppError("RemoveLdapFile", "api.admin.remove_certificate.delete.app_error", map[string]any{"Filename": filename}, err.Error(), http.StatusInternalServerError)
} }
return nil return nil
} }

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

@@ -170,7 +170,7 @@ func (s *Server) SaveLicense(licenseBytes []byte) (*model.License, *model.AppErr
} }
if uniqueUserCount > int64(*license.Features.Users) { if uniqueUserCount > int64(*license.Features.Users) {
return nil, model.NewAppError("addLicense", "api.license.add_license.unique_users.app_error", map[string]interface{}{"Users": *license.Features.Users, "Count": uniqueUserCount}, "", http.StatusBadRequest) return nil, model.NewAppError("addLicense", "api.license.add_license.unique_users.app_error", map[string]any{"Users": *license.Features.Users, "Count": uniqueUserCount}, "", http.StatusBadRequest)
} }
if license.IsExpired() { if license.IsExpired() {

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

@@ -386,7 +386,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
post.UserId, post.UserId,
&model.Post{ &model.Post{
ChannelId: post.ChannelId, ChannelId: post.ChannelId,
Message: T("api.post.disabled_here", map[string]interface{}{"Users": *a.Config().TeamSettings.MaxNotificationsPerChannel}), Message: T("api.post.disabled_here", map[string]any{"Users": *a.Config().TeamSettings.MaxNotificationsPerChannel}),
CreateAt: post.CreateAt + 1, CreateAt: post.CreateAt + 1,
}, },
) )
@@ -397,7 +397,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
post.UserId, post.UserId,
&model.Post{ &model.Post{
ChannelId: post.ChannelId, ChannelId: post.ChannelId,
Message: T("api.post.disabled_channel", map[string]interface{}{"Users": *a.Config().TeamSettings.MaxNotificationsPerChannel}), Message: T("api.post.disabled_channel", map[string]any{"Users": *a.Config().TeamSettings.MaxNotificationsPerChannel}),
CreateAt: post.CreateAt + 1, CreateAt: post.CreateAt + 1,
}, },
) )
@@ -408,7 +408,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
post.UserId, post.UserId,
&model.Post{ &model.Post{
ChannelId: post.ChannelId, ChannelId: post.ChannelId,
Message: T("api.post.disabled_all", map[string]interface{}{"Users": *a.Config().TeamSettings.MaxNotificationsPerChannel}), Message: T("api.post.disabled_all", map[string]any{"Users": *a.Config().TeamSettings.MaxNotificationsPerChannel}),
CreateAt: post.CreateAt + 1, CreateAt: post.CreateAt + 1,
}, },
) )
@@ -801,13 +801,13 @@ func makeOutOfChannelMentionPost(sender *model.User, post *model.Post, outOfChan
ephemeralPostId := model.NewId() ephemeralPostId := model.NewId()
var message string var message string
if len(outOfChannelUsers) == 1 { if len(outOfChannelUsers) == 1 {
message = T("api.post.check_for_out_of_channel_mentions.message.one", map[string]interface{}{ message = T("api.post.check_for_out_of_channel_mentions.message.one", map[string]any{
"Username": ocUsernames[0], "Username": ocUsernames[0],
}) })
} else if len(outOfChannelUsers) > 1 { } else if len(outOfChannelUsers) > 1 {
preliminary, final := splitAtFinal(ocUsernames) preliminary, final := splitAtFinal(ocUsernames)
message = T("api.post.check_for_out_of_channel_mentions.message.multiple", map[string]interface{}{ message = T("api.post.check_for_out_of_channel_mentions.message.multiple", map[string]any{
"Usernames": strings.Join(preliminary, ", @"), "Usernames": strings.Join(preliminary, ", @"),
"LastUsername": final, "LastUsername": final,
}) })
@@ -818,7 +818,7 @@ func makeOutOfChannelMentionPost(sender *model.User, post *model.Post, outOfChan
message += "\n" message += "\n"
} }
message += T("api.post.check_for_out_of_channel_groups_mentions.message.one", map[string]interface{}{ message += T("api.post.check_for_out_of_channel_groups_mentions.message.one", map[string]any{
"Username": ogUsernames[0], "Username": ogUsernames[0],
}) })
} else if len(outOfGroupsUsers) > 1 { } else if len(outOfGroupsUsers) > 1 {
@@ -828,7 +828,7 @@ func makeOutOfChannelMentionPost(sender *model.User, post *model.Post, outOfChan
message += "\n" message += "\n"
} }
message += T("api.post.check_for_out_of_channel_groups_mentions.message.multiple", map[string]interface{}{ message += T("api.post.check_for_out_of_channel_groups_mentions.message.multiple", map[string]any{
"Usernames": strings.Join(preliminary, ", @"), "Usernames": strings.Join(preliminary, ", @"),
"LastUsername": final, "LastUsername": final,
}) })
@@ -986,7 +986,7 @@ func getExplicitMentions(post *model.Post, keywords map[string][]string, groups
buf := "" buf := ""
mentionsEnabledFields := getMentionsEnabledFields(post) mentionsEnabledFields := getMentionsEnabledFields(post)
for _, message := range mentionsEnabledFields { for _, message := range mentionsEnabledFields {
markdown.Inspect(message, func(node interface{}) bool { markdown.Inspect(message, func(node any) bool {
text, ok := node.(*markdown.Text) text, ok := node.(*markdown.Text)
if !ok { if !ok {
ret.processText(buf, keywords, groups) ret.processText(buf, keywords, groups)

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

@@ -145,7 +145,7 @@ func (a *App) sendNotificationEmail(notification *PostNotification, user *model.
*/ */
func getDirectMessageNotificationEmailSubject(user *model.User, post *model.Post, translateFunc i18n.TranslateFunc, siteName string, senderName string, useMilitaryTime bool) string { func getDirectMessageNotificationEmailSubject(user *model.User, post *model.Post, translateFunc i18n.TranslateFunc, siteName string, senderName string, useMilitaryTime bool) string {
t := getFormattedPostTime(user, post, useMilitaryTime, translateFunc) t := getFormattedPostTime(user, post, useMilitaryTime, translateFunc)
var subjectParameters = map[string]interface{}{ var subjectParameters = map[string]any{
"SiteName": siteName, "SiteName": siteName,
"SenderDisplayName": senderName, "SenderDisplayName": senderName,
"Month": t.Month, "Month": t.Month,
@@ -160,7 +160,7 @@ func getDirectMessageNotificationEmailSubject(user *model.User, post *model.Post
*/ */
func getNotificationEmailSubject(user *model.User, post *model.Post, translateFunc i18n.TranslateFunc, siteName string, teamName string, useMilitaryTime bool) string { func getNotificationEmailSubject(user *model.User, post *model.Post, translateFunc i18n.TranslateFunc, siteName string, teamName string, useMilitaryTime bool) string {
t := getFormattedPostTime(user, post, useMilitaryTime, translateFunc) t := getFormattedPostTime(user, post, useMilitaryTime, translateFunc)
var subjectParameters = map[string]interface{}{ var subjectParameters = map[string]any{
"SiteName": siteName, "SiteName": siteName,
"TeamName": teamName, "TeamName": teamName,
"Month": t.Month, "Month": t.Month,
@@ -175,7 +175,7 @@ func getNotificationEmailSubject(user *model.User, post *model.Post, translateFu
*/ */
func getGroupMessageNotificationEmailSubject(user *model.User, post *model.Post, translateFunc i18n.TranslateFunc, siteName string, channelName string, emailNotificationContentsType string, useMilitaryTime bool) string { func getGroupMessageNotificationEmailSubject(user *model.User, post *model.Post, translateFunc i18n.TranslateFunc, siteName string, channelName string, emailNotificationContentsType string, useMilitaryTime bool) string {
t := getFormattedPostTime(user, post, useMilitaryTime, translateFunc) t := getFormattedPostTime(user, post, useMilitaryTime, translateFunc)
var subjectParameters = map[string]interface{}{ var subjectParameters = map[string]any{
"SiteName": siteName, "SiteName": siteName,
"Month": t.Month, "Month": t.Month,
"Day": t.Day, "Day": t.Day,
@@ -222,7 +222,7 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
} }
t := getFormattedPostTime(recipient, post, useMilitaryTime, translateFunc) t := getFormattedPostTime(recipient, post, useMilitaryTime, translateFunc)
messageTime := map[string]interface{}{ messageTime := map[string]any{
"Hour": t.Hour, "Hour": t.Hour,
"Minute": t.Minute, "Minute": t.Minute,
"TimeZone": t.TimeZone, "TimeZone": t.TimeZone,
@@ -262,36 +262,36 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
if channel.Type == model.ChannelTypeDirect { if channel.Type == model.ChannelTypeDirect {
// Direct Messages // Direct Messages
data.Props["Title"] = translateFunc("app.notification.body.dm.title", map[string]interface{}{"SenderName": senderName}) data.Props["Title"] = translateFunc("app.notification.body.dm.title", map[string]any{"SenderName": senderName})
data.Props["SubTitle"] = translateFunc("app.notification.body.dm.subTitle", map[string]interface{}{"SenderName": senderName}) data.Props["SubTitle"] = translateFunc("app.notification.body.dm.subTitle", map[string]any{"SenderName": senderName})
} else if channel.Type == model.ChannelTypeGroup { } else if channel.Type == model.ChannelTypeGroup {
// Group Messages // Group Messages
data.Props["Title"] = translateFunc("app.notification.body.group.title", map[string]interface{}{"SenderName": senderName}) data.Props["Title"] = translateFunc("app.notification.body.group.title", map[string]any{"SenderName": senderName})
data.Props["SubTitle"] = translateFunc("app.notification.body.group.subTitle", map[string]interface{}{"SenderName": senderName}) data.Props["SubTitle"] = translateFunc("app.notification.body.group.subTitle", map[string]any{"SenderName": senderName})
} else { } else {
// mentions // mentions
data.Props["Title"] = translateFunc("app.notification.body.mention.title", map[string]interface{}{"SenderName": senderName}) data.Props["Title"] = translateFunc("app.notification.body.mention.title", map[string]any{"SenderName": senderName})
data.Props["SubTitle"] = translateFunc("app.notification.body.mention.subTitle", map[string]interface{}{"SenderName": senderName, "ChannelName": channelName}) data.Props["SubTitle"] = translateFunc("app.notification.body.mention.subTitle", map[string]any{"SenderName": senderName, "ChannelName": channelName})
pData.ChannelName = channelName pData.ChannelName = channelName
} }
// Override title and subtile for replies with CRT enabled // Override title and subtile for replies with CRT enabled
if a.IsCRTEnabledForUser(recipient.Id) && post.RootId != "" { if a.IsCRTEnabledForUser(recipient.Id) && post.RootId != "" {
// Title is the same in all cases // Title is the same in all cases
data.Props["Title"] = translateFunc("app.notification.body.thread.title", map[string]interface{}{"SenderName": senderName}) data.Props["Title"] = translateFunc("app.notification.body.thread.title", map[string]any{"SenderName": senderName})
if channel.Type == model.ChannelTypeDirect { if channel.Type == model.ChannelTypeDirect {
// Direct Reply // Direct Reply
data.Props["SubTitle"] = translateFunc("app.notification.body.thread_dm.subTitle", map[string]interface{}{"SenderName": senderName}) data.Props["SubTitle"] = translateFunc("app.notification.body.thread_dm.subTitle", map[string]any{"SenderName": senderName})
} else if channel.Type == model.ChannelTypeGroup { } else if channel.Type == model.ChannelTypeGroup {
// Group Reply // Group Reply
data.Props["SubTitle"] = translateFunc("app.notification.body.thread_gm.subTitle", map[string]interface{}{"SenderName": senderName}) data.Props["SubTitle"] = translateFunc("app.notification.body.thread_gm.subTitle", map[string]any{"SenderName": senderName})
} else if emailNotificationContentsType == model.EmailNotificationContentsFull { } else if emailNotificationContentsType == model.EmailNotificationContentsFull {
// Channel Reply with full content // Channel Reply with full content
data.Props["SubTitle"] = translateFunc("app.notification.body.thread_channel_full.subTitle", map[string]interface{}{"SenderName": senderName, "ChannelName": channelName}) data.Props["SubTitle"] = translateFunc("app.notification.body.thread_channel_full.subTitle", map[string]any{"SenderName": senderName, "ChannelName": channelName})
} else { } else {
// Channel Reply with generic content // Channel Reply with generic content
data.Props["SubTitle"] = translateFunc("app.notification.body.thread_channel.subTitle", map[string]interface{}{"SenderName": senderName}) data.Props["SubTitle"] = translateFunc("app.notification.body.thread_channel.subTitle", map[string]any{"SenderName": senderName})
} }
} }

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

@@ -660,7 +660,7 @@ func (a *App) buildFullPushNotificationMessage(contentsConfig string, post *mode
msg.IsCRTEnabled = true msg.IsCRTEnabled = true
if post.RootId != "" { if post.RootId != "" {
if contentsConfig != model.GenericNoChannelNotification { if contentsConfig != model.GenericNoChannelNotification {
props := map[string]interface{}{"channelName": channelName} props := map[string]any{"channelName": channelName}
msg.ChannelName = userLocale("api.push_notification.title.collapsed_threads", props) msg.ChannelName = userLocale("api.push_notification.title.collapsed_threads", props)
if channel.Type == model.ChannelTypeDirect { if channel.Type == model.ChannelTypeDirect {

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

@@ -1441,7 +1441,7 @@ func TestPushNotificationRace(t *testing.T) {
filestore: &fmocks.FileBackend{}, filestore: &fmocks.FileBackend{},
} }
s.configStore = &configWrapper{srv: s, Store: memoryStore} s.configStore = &configWrapper{srv: s, Store: memoryStore}
serviceMap := map[ServiceKey]interface{}{ serviceMap := map[ServiceKey]any{
ConfigKey: s.configStore, ConfigKey: s.configStore,
LicenseKey: &licenseWrapper{s}, LicenseKey: &licenseWrapper{s},
FilestoreKey: s.filestore, FilestoreKey: s.filestore,
@@ -1481,7 +1481,7 @@ func TestPushNotificationAttachment(t *testing.T) {
originalMessage := "hello world" originalMessage := "hello world"
post := &model.Post{ post := &model.Post{
Message: originalMessage, Message: originalMessage,
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
AuthorName: "testuser", AuthorName: "testuser",

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

@@ -41,7 +41,7 @@ func TestSendNotifications(t *testing.T) {
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
Message: "@" + th.BasicUser2.Username, Message: "@" + th.BasicUser2.Username,
Type: model.PostTypeAddToChannel, Type: model.PostTypeAddToChannel,
Props: map[string]interface{}{model.PostPropsAddedUserId: "junk"}, Props: map[string]any{model.PostPropsAddedUserId: "junk"},
}, true) }, true)
require.Nil(t, appErr) require.Nil(t, appErr)
@@ -181,7 +181,7 @@ func TestSendNotificationsWithManyUsers(t *testing.T) {
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
Message: "@channel", Message: "@channel",
Type: model.PostTypeAddToChannel, Type: model.PostTypeAddToChannel,
Props: map[string]interface{}{model.PostPropsAddedUserId: "junk"}, Props: map[string]any{model.PostPropsAddedUserId: "junk"},
}, true) }, true)
require.Nil(t, appErr1) require.Nil(t, appErr1)
@@ -201,7 +201,7 @@ func TestSendNotificationsWithManyUsers(t *testing.T) {
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
Message: "@channel", Message: "@channel",
Type: model.PostTypeAddToChannel, Type: model.PostTypeAddToChannel,
Props: map[string]interface{}{model.PostPropsAddedUserId: "junk"}, Props: map[string]any{model.PostPropsAddedUserId: "junk"},
}, true) }, true)
require.Nil(t, appErr1) require.Nil(t, appErr1)

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

@@ -567,7 +567,7 @@ func (a *App) getSSOProvider(service string) (einterfaces.OAuthProvider, *model.
provider := einterfaces.GetOAuthProvider(providerType) provider := einterfaces.GetOAuthProvider(providerType)
if provider == nil { if provider == nil {
return nil, model.NewAppError("getSSOProvider", "api.user.login_by_oauth.not_available.app_error", return nil, model.NewAppError("getSSOProvider", "api.user.login_by_oauth.not_available.app_error",
map[string]interface{}{"Service": strings.Title(service)}, "", http.StatusNotImplemented) map[string]any{"Service": strings.Title(service)}, "", http.StatusNotImplemented)
} }
return provider, nil return provider, nil
} }
@@ -581,18 +581,18 @@ func (a *App) LoginByOAuth(c *request.Context, service string, userData io.Reade
buf := bytes.Buffer{} buf := bytes.Buffer{}
if _, err := buf.ReadFrom(userData); err != nil { if _, err := buf.ReadFrom(userData); err != nil {
return nil, model.NewAppError("LoginByOAuth2", "api.user.login_by_oauth.parse.app_error", return nil, model.NewAppError("LoginByOAuth2", "api.user.login_by_oauth.parse.app_error",
map[string]interface{}{"Service": service}, "", http.StatusBadRequest) map[string]any{"Service": service}, "", http.StatusBadRequest)
} }
authUser, err1 := provider.GetUserFromJSON(bytes.NewReader(buf.Bytes()), tokenUser) authUser, err1 := provider.GetUserFromJSON(bytes.NewReader(buf.Bytes()), tokenUser)
if err1 != nil { if err1 != nil {
return nil, model.NewAppError("LoginByOAuth", "api.user.login_by_oauth.parse.app_error", return nil, model.NewAppError("LoginByOAuth", "api.user.login_by_oauth.parse.app_error",
map[string]interface{}{"Service": service}, err1.Error(), http.StatusBadRequest) map[string]any{"Service": service}, err1.Error(), http.StatusBadRequest)
} }
if *authUser.AuthData == "" { if *authUser.AuthData == "" {
return nil, model.NewAppError("LoginByOAuth3", "api.user.login_by_oauth.parse.app_error", return nil, model.NewAppError("LoginByOAuth3", "api.user.login_by_oauth.parse.app_error",
map[string]interface{}{"Service": service}, "", http.StatusBadRequest) map[string]any{"Service": service}, "", http.StatusBadRequest)
} }
user, err := a.GetUserByAuth(model.NewString(*authUser.AuthData), service) user, err := a.GetUserByAuth(model.NewString(*authUser.AuthData), service)
@@ -638,12 +638,12 @@ func (a *App) CompleteSwitchWithOAuth(service string, userData io.Reader, email
ssoUser, err1 := provider.GetUserFromJSON(userData, tokenUser) ssoUser, err1 := provider.GetUserFromJSON(userData, tokenUser)
if err1 != nil { if err1 != nil {
return nil, model.NewAppError("CompleteSwitchWithOAuth", "api.user.complete_switch_with_oauth.parse.app_error", return nil, model.NewAppError("CompleteSwitchWithOAuth", "api.user.complete_switch_with_oauth.parse.app_error",
map[string]interface{}{"Service": service}, err1.Error(), http.StatusBadRequest) map[string]any{"Service": service}, err1.Error(), http.StatusBadRequest)
} }
if *ssoUser.AuthData == "" { if *ssoUser.AuthData == "" {
return nil, model.NewAppError("CompleteSwitchWithOAuth", "api.user.complete_switch_with_oauth.parse.app_error", return nil, model.NewAppError("CompleteSwitchWithOAuth", "api.user.complete_switch_with_oauth.parse.app_error",
map[string]interface{}{"Service": service}, "", http.StatusBadRequest) map[string]any{"Service": service}, "", http.StatusBadRequest)
} }
user, nErr := a.Srv().Store.User().GetByEmail(email) user, nErr := a.Srv().Store.User().GetByEmail(email)
@@ -877,7 +877,7 @@ func (a *App) AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service
req, requestErr = http.NewRequest("GET", *sso.UserAPIEndpoint, strings.NewReader("")) req, requestErr = http.NewRequest("GET", *sso.UserAPIEndpoint, strings.NewReader(""))
if requestErr != nil { if requestErr != nil {
return nil, "", stateProps, nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.service.app_error", map[string]interface{}{"Service": service}, requestErr.Error(), http.StatusInternalServerError) return nil, "", stateProps, nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.service.app_error", map[string]any{"Service": service}, requestErr.Error(), http.StatusInternalServerError)
} }
req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
@@ -886,7 +886,7 @@ func (a *App) AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service
resp, err = a.HTTPService().MakeClient(true).Do(req) resp, err = a.HTTPService().MakeClient(true).Do(req)
if err != nil { if err != nil {
return nil, "", stateProps, nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.service.app_error", map[string]interface{}{"Service": service}, err.Error(), http.StatusInternalServerError) return nil, "", stateProps, nil, model.NewAppError("AuthorizeOAuthUser", "api.user.authorize_oauth_user.service.app_error", map[string]any{"Service": service}, err.Error(), http.StatusInternalServerError)
} else if resp.StatusCode != http.StatusOK { } else if resp.StatusCode != http.StatusOK {
defer resp.Body.Close() defer resp.Body.Close()

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

@@ -3933,7 +3933,7 @@ func (a *OpenTracingAppLayer) EnsureBot(c *request.Context, productID string, bo
return resultVar0, resultVar1 return resultVar0, resultVar1
} }
func (a *OpenTracingAppLayer) EnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} { func (a *OpenTracingAppLayer) EnvironmentConfig(filter func(reflect.StructField) bool) map[string]any {
origCtx := a.ctx origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.EnvironmentConfig") span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.EnvironmentConfig")
@@ -5865,7 +5865,7 @@ func (a *OpenTracingAppLayer) GetEmojiStaticURL(emojiName string) (string, *mode
return resultVar0, resultVar1 return resultVar0, resultVar1
} }
func (a *OpenTracingAppLayer) GetEnvironmentConfig(filter func(reflect.StructField) bool) map[string]interface{} { func (a *OpenTracingAppLayer) GetEnvironmentConfig(filter func(reflect.StructField) bool) map[string]any {
origCtx := a.ctx origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetEnvironmentConfig") span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetEnvironmentConfig")
@@ -9117,7 +9117,7 @@ func (a *OpenTracingAppLayer) GetStatusFromCache(userID string) *model.Status {
return resultVar0 return resultVar0
} }
func (a *OpenTracingAppLayer) GetStatusesByIds(userIDs []string) (map[string]interface{}, *model.AppError) { func (a *OpenTracingAppLayer) GetStatusesByIds(userIDs []string) (map[string]any, *model.AppError) {
origCtx := a.ctx origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetStatusesByIds") span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetStatusesByIds")

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

@@ -20,7 +20,7 @@ type Option func(s *Server) error
// construct an app with a different store. // construct an app with a different store.
// //
// The override parameter must be either a store.Store or func(App) store.Store(). // The override parameter must be either a store.Store or func(App) store.Store().
func StoreOverride(override interface{}) Option { func StoreOverride(override any) Option {
return func(s *Server) error { return func(s *Server) error {
switch o := override.(type) { switch o := override.(type) {
case store.Store: case store.Store:

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

@@ -54,7 +54,7 @@ func TestExportPermissions(t *testing.T) {
firstResult := results[0] firstResult := results[0]
var row map[string]interface{} var row map[string]any
err = json.Unmarshal(firstResult, &row) err = json.Unmarshal(firstResult, &row)
if err != nil { if err != nil {
t.Error(err) t.Error(err)

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

@@ -40,8 +40,8 @@ func NewPluginAPI(a *App, c *request.Context, manifest *model.Manifest) *PluginA
} }
} }
func (api *PluginAPI) LoadPluginConfiguration(dest interface{}) error { func (api *PluginAPI) LoadPluginConfiguration(dest any) error {
finalConfig := make(map[string]interface{}) finalConfig := make(map[string]any)
// First set final config to defaults // First set final config to defaults
if api.manifest.SettingsSchema != nil { if api.manifest.SettingsSchema != nil {
@@ -104,15 +104,15 @@ func (api *PluginAPI) SaveConfig(config *model.Config) *model.AppError {
return err return err
} }
func (api *PluginAPI) GetPluginConfig() map[string]interface{} { func (api *PluginAPI) GetPluginConfig() map[string]any {
cfg := api.app.GetSanitizedConfig() cfg := api.app.GetSanitizedConfig()
if pluginConfig, isOk := cfg.PluginSettings.Plugins[api.manifest.Id]; isOk { if pluginConfig, isOk := cfg.PluginSettings.Plugins[api.manifest.Id]; isOk {
return pluginConfig return pluginConfig
} }
return map[string]interface{}{} return map[string]any{}
} }
func (api *PluginAPI) SavePluginConfig(pluginConfig map[string]interface{}) *model.AppError { func (api *PluginAPI) SavePluginConfig(pluginConfig map[string]any) *model.AppError {
cfg := api.app.GetSanitizedConfig() cfg := api.app.GetSanitizedConfig()
cfg.PluginSettings.Plugins[api.manifest.Id] = pluginConfig cfg.PluginSettings.Plugins[api.manifest.Id] = pluginConfig
_, _, err := api.app.SaveConfig(cfg, true) _, _, err := api.app.SaveConfig(cfg, true)
@@ -908,7 +908,7 @@ func (api *PluginAPI) KVList(page, perPage int) ([]string, *model.AppError) {
return api.app.ListPluginKeys(api.id, page, perPage) return api.app.ListPluginKeys(api.id, page, perPage)
} }
func (api *PluginAPI) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) { func (api *PluginAPI) PublishWebSocketEvent(event string, payload map[string]any, broadcast *model.WebsocketBroadcast) {
ev := model.NewWebSocketEvent(fmt.Sprintf("custom_%v_%v", api.id, event), "", "", "", nil) ev := model.NewWebSocketEvent(fmt.Sprintf("custom_%v_%v", api.id, event), "", "", "", nil)
ev = ev.SetBroadcast(broadcast).SetData(payload) ev = ev.SetBroadcast(broadcast).SetData(payload)
api.app.Publish(ev) api.app.Publish(ev)
@@ -930,16 +930,16 @@ func (api *PluginAPI) RolesGrantPermission(roleNames []string, permissionId stri
return api.app.RolesGrantPermission(roleNames, permissionId) return api.app.RolesGrantPermission(roleNames, permissionId)
} }
func (api *PluginAPI) LogDebug(msg string, keyValuePairs ...interface{}) { func (api *PluginAPI) LogDebug(msg string, keyValuePairs ...any) {
api.logger.Debugw(msg, keyValuePairs...) api.logger.Debugw(msg, keyValuePairs...)
} }
func (api *PluginAPI) LogInfo(msg string, keyValuePairs ...interface{}) { func (api *PluginAPI) LogInfo(msg string, keyValuePairs ...any) {
api.logger.Infow(msg, keyValuePairs...) api.logger.Infow(msg, keyValuePairs...)
} }
func (api *PluginAPI) LogError(msg string, keyValuePairs ...interface{}) { func (api *PluginAPI) LogError(msg string, keyValuePairs ...any) {
api.logger.Errorw(msg, keyValuePairs...) api.logger.Errorw(msg, keyValuePairs...)
} }
func (api *PluginAPI) LogWarn(msg string, keyValuePairs ...interface{}) { func (api *PluginAPI) LogWarn(msg string, keyValuePairs ...any) {
api.logger.Warnw(msg, keyValuePairs...) api.logger.Warnw(msg, keyValuePairs...)
} }

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

@@ -54,7 +54,7 @@ func getDefaultPluginSettingsSchema() string {
func setDefaultPluginConfig(th *TestHelper, pluginID string) { func setDefaultPluginConfig(th *TestHelper, pluginID string) {
th.App.UpdateConfig(func(cfg *model.Config) { th.App.UpdateConfig(func(cfg *model.Config) {
cfg.PluginSettings.Plugins[pluginID] = map[string]interface{}{ cfg.PluginSettings.Plugins[pluginID] = map[string]any{
"BasicChannelName": th.BasicChannel.Name, "BasicChannelName": th.BasicChannel.Name,
"BasicChannelId": th.BasicChannel.Id, "BasicChannelId": th.BasicChannel.Id,
"BasicTeamName": th.BasicTeam.Name, "BasicTeamName": th.BasicTeam.Name,
@@ -691,7 +691,7 @@ func TestPluginAPISavePluginConfig(t *testing.T) {
pluginConfigJsonString := `{"mystringsetting": "str", "MyIntSetting": 32, "myboolsetting": true}` pluginConfigJsonString := `{"mystringsetting": "str", "MyIntSetting": 32, "myboolsetting": true}`
var pluginConfig map[string]interface{} var pluginConfig map[string]any
err := json.Unmarshal([]byte(pluginConfigJsonString), &pluginConfig) err := json.Unmarshal([]byte(pluginConfigJsonString), &pluginConfig)
require.NoError(t, err) require.NoError(t, err)
@@ -733,7 +733,7 @@ func TestPluginAPIGetPluginConfig(t *testing.T) {
api := NewPluginAPI(th.App, th.Context, manifest) api := NewPluginAPI(th.App, th.Context, manifest)
pluginConfigJsonString := `{"mystringsetting": "str", "myintsetting": 32, "myboolsetting": true}` pluginConfigJsonString := `{"mystringsetting": "str", "myintsetting": 32, "myboolsetting": true}`
var pluginConfig map[string]interface{} var pluginConfig map[string]any
err := json.Unmarshal([]byte(pluginConfigJsonString), &pluginConfig) err := json.Unmarshal([]byte(pluginConfigJsonString), &pluginConfig)
require.NoError(t, err) require.NoError(t, err)
@@ -750,7 +750,7 @@ func TestPluginAPILoadPluginConfiguration(t *testing.T) {
th := Setup(t) th := Setup(t)
defer th.TearDown() defer th.TearDown()
var pluginJson map[string]interface{} var pluginJson map[string]any
err := json.Unmarshal([]byte(`{"mystringsetting": "str", "MyIntSetting": 32, "myboolsetting": true}`), &pluginJson) err := json.Unmarshal([]byte(`{"mystringsetting": "str", "MyIntSetting": 32, "myboolsetting": true}`), &pluginJson)
require.NoError(t, err) require.NoError(t, err)
@@ -785,7 +785,7 @@ func TestPluginAPILoadPluginConfigurationDefaults(t *testing.T) {
th := Setup(t) th := Setup(t)
defer th.TearDown() defer th.TearDown()
var pluginJson map[string]interface{} var pluginJson map[string]any
err := json.Unmarshal([]byte(`{"mystringsetting": "override"}`), &pluginJson) err := json.Unmarshal([]byte(`{"mystringsetting": "override"}`), &pluginJson)
require.NoError(t, err) require.NoError(t, err)
@@ -967,7 +967,7 @@ func TestInstallPlugin(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.PluginSettings.Enable = true *cfg.PluginSettings.Enable = true
*cfg.PluginSettings.EnableUploads = true *cfg.PluginSettings.EnableUploads = true
cfg.PluginSettings.Plugins["testinstallplugin"] = map[string]interface{}{ cfg.PluginSettings.Plugins["testinstallplugin"] = map[string]any{
"DownloadURL": ts.URL + "/testplugin.tar.gz", "DownloadURL": ts.URL + "/testplugin.tar.gz",
} }
}) })
@@ -1789,7 +1789,7 @@ func TestPluginHTTPUpgradeWebSocket(t *testing.T) {
require.Equal(t, resp.Status, model.StatusOk) require.Equal(t, resp.Status, model.StatusOk)
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
wsc.SendMessage("custom_action", map[string]interface{}{"value": i}) wsc.SendMessage("custom_action", map[string]any{"value": i})
var resp *model.WebSocketResponse var resp *model.WebSocketResponse
select { select {
case resp = <-wsc.ResponseChannel: case resp = <-wsc.ResponseChannel:

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

@@ -19,7 +19,7 @@ type BasicConfig struct {
BasicUserID string BasicUserID string
} }
func IsEmpty(object interface{}) bool { func IsEmpty(object any) bool {
// get nil case out of the way // get nil case out of the way
if object == nil { if object == nil {

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

@@ -37,7 +37,7 @@ func (p *Plugin) ServeHTTP(_ *plugin.Context, w http.ResponseWriter, r *http.Req
if err != nil { if err != nil {
break break
} }
resp := model.NewWebSocketResponse("OK", req.Seq, map[string]interface{}{"action": req.Action, "value": req.Data["value"]}) resp := model.NewWebSocketResponse("OK", req.Seq, map[string]any{"action": req.Action, "value": req.Data["value"]})
respJSON, err := resp.ToJSON() respJSON, err := resp.ToJSON()
if err != nil { if err != nil {
break break

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

@@ -142,7 +142,7 @@ func (a *App) tryExecutePluginCommand(c *request.Context, args *model.CommandArg
// Checking if plugin is working or not // Checking if plugin is working or not
if err := pluginsEnvironment.PerformHealthCheck(matched.PluginId); err != nil { if err := pluginsEnvironment.PerformHealthCheck(matched.PluginId); err != nil {
return matched.Command, nil, model.NewAppError("ExecutePluginCommand", "model.plugin_command_error.error.app_error", map[string]interface{}{"Command": trigger}, "err= Plugin has recently crashed: "+matched.PluginId, http.StatusInternalServerError) return matched.Command, nil, model.NewAppError("ExecutePluginCommand", "model.plugin_command_error.error.app_error", map[string]any{"Command": trigger}, "err= Plugin has recently crashed: "+matched.PluginId, http.StatusInternalServerError)
} }
pluginHooks, err := pluginsEnvironment.HooksForPlugin(matched.PluginId) pluginHooks, err := pluginsEnvironment.HooksForPlugin(matched.PluginId)
@@ -163,7 +163,7 @@ func (a *App) tryExecutePluginCommand(c *request.Context, args *model.CommandArg
// Checking if plugin crashed after running the command // Checking if plugin crashed after running the command
if err := pluginsEnvironment.PerformHealthCheck(matched.PluginId); err != nil { if err := pluginsEnvironment.PerformHealthCheck(matched.PluginId); err != nil {
errMessage := fmt.Sprintf("err= Plugin %s crashed due to /%s command", matched.PluginId, trigger) errMessage := fmt.Sprintf("err= Plugin %s crashed due to /%s command", matched.PluginId, trigger)
return matched.Command, nil, model.NewAppError("ExecutePluginCommand", "model.plugin_command_crash.error.app_error", map[string]interface{}{"Command": trigger, "PluginId": matched.PluginId}, errMessage, http.StatusInternalServerError) return matched.Command, nil, model.NewAppError("ExecutePluginCommand", "model.plugin_command_crash.error.app_error", map[string]any{"Command": trigger, "PluginId": matched.PluginId}, errMessage, http.StatusInternalServerError)
} }
// This is a response from the plugin, which may set an incorrect status code; // This is a response from the plugin, which may set an incorrect status code;
// e.g setting a status code of 0 will crash the server. So we always bucket everything under 500. // e.g setting a status code of 0 will crash the server. So we always bucket everything under 500.

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

@@ -30,7 +30,7 @@ func TestPluginCommand(t *testing.T) {
t.Run("command handled by plugin", func(t *testing.T) { t.Run("command handled by plugin", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { th.App.UpdateConfig(func(cfg *model.Config) {
cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]interface{}{ cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]any{
"TeamId": args.TeamId, "TeamId": args.TeamId,
} }
}) })
@@ -111,7 +111,7 @@ func TestPluginCommand(t *testing.T) {
t.Run("re-entrant command registration on config change", func(t *testing.T) { t.Run("re-entrant command registration on config change", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { th.App.UpdateConfig(func(cfg *model.Config) {
cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]interface{}{ cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]any{
"TeamId": args.TeamId, "TeamId": args.TeamId,
} }
}) })
@@ -162,7 +162,7 @@ func TestPluginCommand(t *testing.T) {
// Saving the plugin config eventually results in a call to // Saving the plugin config eventually results in a call to
// OnConfigurationChange. This used to deadlock on account of // OnConfigurationChange. This used to deadlock on account of
// effectively acquiring a RWLock reentrantly. // effectively acquiring a RWLock reentrantly.
err := p.API.SavePluginConfig(map[string]interface{}{ err := p.API.SavePluginConfig(map[string]any{
"TeamId": p.configuration.TeamId, "TeamId": p.configuration.TeamId,
}) })
if err != nil { if err != nil {
@@ -218,7 +218,7 @@ func TestPluginCommand(t *testing.T) {
t.Run("plugins can override built-in commands", func(t *testing.T) { t.Run("plugins can override built-in commands", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { th.App.UpdateConfig(func(cfg *model.Config) {
cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]interface{}{ cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]any{
"TeamId": args.TeamId, "TeamId": args.TeamId,
} }
}) })
@@ -379,7 +379,7 @@ func TestPluginCommand(t *testing.T) {
t.Run("plugin returning status code 0", func(t *testing.T) { t.Run("plugin returning status code 0", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { th.App.UpdateConfig(func(cfg *model.Config) {
cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]interface{}{ cfg.PluginSettings.Plugins["testloadpluginconfig"] = map[string]any{
"TeamId": args.TeamId, "TeamId": args.TeamId,
} }
}) })

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

@@ -72,7 +72,7 @@ func (d *DriverImpl) ConnPing(connID string) error {
return driver.ErrBadConn return driver.ErrBadConn
} }
return conn.Raw(func(innerConn interface{}) error { return conn.Raw(func(innerConn any) error {
return innerConn.(driver.Pinger).Ping(context.Background()) return innerConn.(driver.Pinger).Ping(context.Background())
}) })
} }
@@ -86,7 +86,7 @@ func (d *DriverImpl) ConnQuery(connID, q string, args []driver.NamedValue) (_ st
return "", driver.ErrBadConn return "", driver.ErrBadConn
} }
err = conn.Raw(func(innerConn interface{}) error { err = conn.Raw(func(innerConn any) error {
rows, err = innerConn.(driver.QueryerContext).QueryContext(context.Background(), q, args) rows, err = innerConn.(driver.QueryerContext).QueryContext(context.Background(), q, args)
return err return err
}) })
@@ -112,7 +112,7 @@ func (d *DriverImpl) ConnExec(connID, q string, args []driver.NamedValue) (_ plu
return ret, driver.ErrBadConn return ret, driver.ErrBadConn
} }
err = conn.Raw(func(innerConn interface{}) error { err = conn.Raw(func(innerConn any) error {
res, err = innerConn.(driver.ExecerContext).ExecContext(context.Background(), q, args) res, err = innerConn.(driver.ExecerContext).ExecContext(context.Background(), q, args)
return err return err
}) })
@@ -148,7 +148,7 @@ func (d *DriverImpl) Tx(connID string, opts driver.TxOptions) (_ string, err err
return "", driver.ErrBadConn return "", driver.ErrBadConn
} }
err = conn.Raw(func(innerConn interface{}) error { err = conn.Raw(func(innerConn any) error {
tx, err = innerConn.(driver.ConnBeginTx).BeginTx(context.Background(), opts) tx, err = innerConn.(driver.ConnBeginTx).BeginTx(context.Background(), opts)
return err return err
}) })
@@ -190,7 +190,7 @@ func (d *DriverImpl) Stmt(connID, q string) (_ string, err error) {
return "", driver.ErrBadConn return "", driver.ErrBadConn
} }
err = conn.Raw(func(innerConn interface{}) error { err = conn.Raw(func(innerConn any) error {
stmt, err = innerConn.(driver.Conn).Prepare(q) stmt, err = innerConn.(driver.Conn).Prepare(q)
return err return err
}) })

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

@@ -54,7 +54,7 @@ func TestPluginDeadlock(t *testing.T) {
UserId: "{{.User.Id}}", UserId: "{{.User.Id}}",
ChannelId: "{{.Channel.Id}}", ChannelId: "{{.Channel.Id}}",
Message: "message", Message: "message",
Props: map[string]interface{}{ Props: map[string]any{
"from_plugin": true, "from_plugin": true,
}, },
}) })
@@ -129,7 +129,7 @@ func TestPluginDeadlock(t *testing.T) {
UserId: "{{.User.Id}}", UserId: "{{.User.Id}}",
ChannelId: "{{.Channel.Id}}", ChannelId: "{{.Channel.Id}}",
Message: "message", Message: "message",
Props: map[string]interface{}{ Props: map[string]any{
"from_plugin": true, "from_plugin": true,
}, },
}) })
@@ -244,7 +244,7 @@ func TestPluginDeadlock(t *testing.T) {
UserId: "{{.User.Id}}", UserId: "{{.User.Id}}",
ChannelId: "{{.Channel.Id}}", ChannelId: "{{.Channel.Id}}",
Message: "messageUpdated", Message: "messageUpdated",
Props: map[string]interface{}{ Props: map[string]any{
"from_plugin": true, "from_plugin": true,
}, },
} }

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

@@ -885,7 +885,7 @@ func TestErrorString(t *testing.T) {
} }
func (p *MyPlugin) OnActivate() error { func (p *MyPlugin) OnActivate() error {
return model.NewAppError("where", "id", map[string]interface{}{"param": 1}, "details", 42) return model.NewAppError("where", "id", map[string]any{"param": 1}, "details", 42)
} }
func main() { func main() {

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

@@ -320,7 +320,7 @@ func extractPlugin(pluginFile io.ReadSeeker, extractDir string) (*model.Manifest
} }
if !model.IsValidPluginId(manifest.Id) { if !model.IsValidPluginId(manifest.Id) {
return nil, "", model.NewAppError("installPluginLocally", "app.plugin.invalid_id.app_error", map[string]interface{}{"Min": model.MinIdLength, "Max": model.MaxIdLength, "Regex": model.ValidIdRegex}, "", http.StatusBadRequest) return nil, "", model.NewAppError("installPluginLocally", "app.plugin.invalid_id.app_error", map[string]any{"Min": model.MinIdLength, "Max": model.MaxIdLength, "Regex": model.ValidIdRegex}, "", http.StatusBadRequest)
} }
return manifest, extractDir, nil return manifest, extractDir, nil

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

@@ -44,12 +44,12 @@ func (a *App) CreatePostAsUser(c *request.Context, post *model.Post, currentSess
// Check that channel has not been deleted // Check that channel has not been deleted
channel, errCh := a.Srv().Store.Channel().Get(post.ChannelId, true) channel, errCh := a.Srv().Store.Channel().Get(post.ChannelId, true)
if errCh != nil { if errCh != nil {
err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, errCh.Error(), http.StatusBadRequest) err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]any{"Name": "post.channel_id"}, errCh.Error(), http.StatusBadRequest)
return nil, err return nil, err
} }
if strings.HasPrefix(post.Type, model.PostSystemMessagePrefix) { if strings.HasPrefix(post.Type, model.PostSystemMessagePrefix) {
err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.type"}, "", http.StatusBadRequest) err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]any{"Name": "post.type"}, "", http.StatusBadRequest)
return nil, err return nil, err
} }
@@ -240,7 +240,7 @@ func (a *App) CreatePost(c *request.Context, post *model.Post, channel *model.Ch
if attachments, ok := post.GetProp("attachments").([]*model.SlackAttachment); ok { if attachments, ok := post.GetProp("attachments").([]*model.SlackAttachment); ok {
jsonAttachments, err := json.Marshal(attachments) jsonAttachments, err := json.Marshal(attachments)
if err == nil { if err == nil {
attachmentsInterface := []interface{}{} attachmentsInterface := []any{}
err = json.Unmarshal(jsonAttachments, &attachmentsInterface) err = json.Unmarshal(jsonAttachments, &attachmentsInterface)
post.AddProp("attachments", attachmentsInterface) post.AddProp("attachments", attachmentsInterface)
} }
@@ -410,13 +410,13 @@ func (a *App) attachFilesToPost(post *model.Post) *model.AppError {
// If channel is nil, FillInPostProps will look up the channel corresponding to the post. // If channel is nil, FillInPostProps will look up the channel corresponding to the post.
func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError { func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError {
channelMentions := post.ChannelMentions() channelMentions := post.ChannelMentions()
channelMentionsProp := make(map[string]interface{}) channelMentionsProp := make(map[string]any)
if len(channelMentions) > 0 { if len(channelMentions) > 0 {
if channel == nil { if channel == nil {
postChannel, err := a.Srv().Store.Channel().GetForPost(post.Id) postChannel, err := a.Srv().Store.Channel().GetForPost(post.Id)
if err != nil { if err != nil {
return model.NewAppError("FillInPostProps", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, err.Error(), http.StatusBadRequest) return model.NewAppError("FillInPostProps", "api.context.invalid_param.app_error", map[string]any{"Name": "post.channel_id"}, err.Error(), http.StatusBadRequest)
} }
channel = postChannel channel = postChannel
} }
@@ -433,7 +433,7 @@ func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.A
mlog.Warn("Failed to get team of the channel mention", mlog.String("team_id", channel.TeamId), mlog.String("channel_id", channel.Id), mlog.Err(err)) mlog.Warn("Failed to get team of the channel mention", mlog.String("team_id", channel.TeamId), mlog.String("channel_id", channel.Id), mlog.Err(err))
continue continue
} }
channelMentionsProp[mentioned.Name] = map[string]interface{}{ channelMentionsProp[mentioned.Name] = map[string]any{
"display_name": mentioned.DisplayName, "display_name": mentioned.DisplayName,
"team_name": team.Name, "team_name": team.Name,
} }
@@ -589,7 +589,7 @@ func (a *App) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool)
} }
if oldPost.DeleteAt != 0 { if oldPost.DeleteAt != 0 {
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_details.app_error", map[string]interface{}{"PostId": post.Id}, "", http.StatusBadRequest) err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_details.app_error", map[string]any{"PostId": post.Id}, "", http.StatusBadRequest)
return nil, err return nil, err
} }
@@ -599,7 +599,7 @@ func (a *App) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool)
} }
if *a.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > oldPost.CreateAt+int64(*a.Config().ServiceSettings.PostEditTimeLimit*1000) && post.Message != oldPost.Message { if *a.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > oldPost.CreateAt+int64(*a.Config().ServiceSettings.PostEditTimeLimit*1000) && post.Message != oldPost.Message {
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_time_limit.app_error", map[string]interface{}{"timeLimit": *a.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest) err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_time_limit.app_error", map[string]any{"timeLimit": *a.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest)
return nil, err return nil, err
} }

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

@@ -433,7 +433,7 @@ func (a *App) getFirstLinkAndImages(str string) (string, []string) {
firstLink := "" firstLink := ""
images := []string{} images := []string{}
markdown.Inspect(str, func(blockOrInline interface{}) bool { markdown.Inspect(str, func(blockOrInline any) bool {
switch v := blockOrInline.(type) { switch v := blockOrInline.(type) {
case *markdown.Autolink: case *markdown.Autolink:
if link := v.Destination(); firstLink == "" && a.isLinkAllowedForPreview(link) { if link := v.Destination(); firstLink == "" && a.isLinkAllowedForPreview(link) {

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

@@ -213,7 +213,7 @@ func TestPreparePostForClient(t *testing.T) {
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
Message: ":" + emoji.Name + ": :taco:", Message: ":" + emoji.Name + ": :taco:",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: ":" + emoji.Name + ":", Text: ":" + emoji.Name + ":",
@@ -257,7 +257,7 @@ func TestPreparePostForClient(t *testing.T) {
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
Message: ":" + emoji3.Name + ": :taco:", Message: ":" + emoji3.Name + ": :taco:",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: ":" + emoji4.Name + ":", Text: ":" + emoji4.Name + ":",
@@ -490,9 +490,9 @@ func TestPreparePostForClient(t *testing.T) {
post, err := th.App.CreatePost(th.Context, &model.Post{ post, err := th.App.CreatePost(th.Context, &model.Post{
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []interface{}{ "attachments": []any{
map[string]interface{}{ map[string]any{
"text": "![icon](" + server.URL + "/test-image1.png)", "text": "![icon](" + server.URL + "/test-image1.png)",
}, },
}, },
@@ -1300,7 +1300,7 @@ func TestGetImagesForPost(t *testing.T) {
Embeds: []*model.PostEmbed{ Embeds: []*model.PostEmbed{
{ {
Type: model.PostEmbedOpengraph, Type: model.PostEmbedOpengraph,
Data: map[string]interface{}{}, Data: map[string]any{},
}, },
}, },
}, },
@@ -1401,7 +1401,7 @@ func TestGetEmojiNamesForPost(t *testing.T) {
Description: "in message attachments", Description: "in message attachments",
Post: &model.Post{ Post: &model.Post{
Message: "this is a post", Message: "this is a post",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: ":emoji1:", Text: ":emoji1:",
@@ -1429,7 +1429,7 @@ func TestGetEmojiNamesForPost(t *testing.T) {
Description: "with duplicates", Description: "with duplicates",
Post: &model.Post{ Post: &model.Post{
Message: "this is :emoji1", Message: "this is :emoji1",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: ":emoji2:", Text: ":emoji2:",
@@ -1486,7 +1486,7 @@ func TestGetCustomEmojisForPost(t *testing.T) {
post := &model.Post{ post := &model.Post{
Message: ":" + emojis[1].Name + ":", Message: ":" + emojis[1].Name + ":",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Pretext: ":" + emojis[2].Name + ":", Pretext: ":" + emojis[2].Name + ":",
@@ -1512,7 +1512,7 @@ func TestGetCustomEmojisForPost(t *testing.T) {
t.Run("with emojis that don't exist", func(t *testing.T) { t.Run("with emojis that don't exist", func(t *testing.T) {
post := &model.Post{ post := &model.Post{
Message: ":secret: :" + emojis[0].Name + ":", Message: ":secret: :" + emojis[0].Name + ":",
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: ":imaginary:", Text: ":imaginary:",
@@ -1529,7 +1529,7 @@ func TestGetCustomEmojisForPost(t *testing.T) {
t.Run("with no emojis", func(t *testing.T) { t.Run("with no emojis", func(t *testing.T) {
post := &model.Post{ post := &model.Post{
Message: "this post is boring", Message: "this post is boring",
Props: map[string]interface{}{}, Props: map[string]any{},
} }
emojisForPost, err := th.App.getCustomEmojisForPost(post, nil) emojisForPost, err := th.App.getCustomEmojisForPost(post, nil)
@@ -1693,7 +1693,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "empty attachments", Name: "empty attachments",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{}, "attachments": []*model.SlackAttachment{},
}, },
}, },
@@ -1702,7 +1702,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "attachment with no fields that can contain images", Name: "attachment with no fields that can contain images",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Title: "This is the title", Title: "This is the title",
@@ -1715,7 +1715,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "images in text", Name: "images in text",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: "![logo](https://example.com/logo) and ![icon](https://example.com/icon)", Text: "![logo](https://example.com/logo) and ![icon](https://example.com/icon)",
@@ -1728,7 +1728,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "images in pretext", Name: "images in pretext",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Pretext: "![logo](https://example.com/logo1) and ![icon](https://example.com/icon1)", Pretext: "![logo](https://example.com/logo1) and ![icon](https://example.com/icon1)",
@@ -1741,7 +1741,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "images in fields", Name: "images in fields",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Fields: []*model.SlackAttachmentField{ Fields: []*model.SlackAttachmentField{
@@ -1758,7 +1758,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "image in author_icon", Name: "image in author_icon",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
AuthorIcon: "https://example.com/icon2", AuthorIcon: "https://example.com/icon2",
@@ -1771,7 +1771,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "image in image_url", Name: "image in image_url",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
ImageURL: "https://example.com/image", ImageURL: "https://example.com/image",
@@ -1784,7 +1784,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "image in thumb_url", Name: "image in thumb_url",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
ThumbURL: "https://example.com/image", ThumbURL: "https://example.com/image",
@@ -1797,7 +1797,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "image in footer_icon", Name: "image in footer_icon",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
FooterIcon: "https://example.com/image", FooterIcon: "https://example.com/image",
@@ -1810,7 +1810,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "images in multiple fields", Name: "images in multiple fields",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Fields: []*model.SlackAttachmentField{ Fields: []*model.SlackAttachmentField{
@@ -1830,7 +1830,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "non-string field", Name: "non-string field",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Fields: []*model.SlackAttachmentField{ Fields: []*model.SlackAttachmentField{
@@ -1847,7 +1847,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "images in multiple locations", Name: "images in multiple locations",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: "![text](https://example.com/text)", Text: "![text](https://example.com/text)",
@@ -1869,7 +1869,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
{ {
Name: "multiple attachments", Name: "multiple attachments",
Post: &model.Post{ Post: &model.Post{
Props: map[string]interface{}{ Props: map[string]any{
"attachments": []*model.SlackAttachment{ "attachments": []*model.SlackAttachment{
{ {
Text: "![logo](https://example.com/logo)", Text: "![logo](https://example.com/logo)",

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

@@ -429,8 +429,8 @@ func TestPostChannelMentions(t *testing.T) {
post, err = th.App.CreatePostAsUser(th.Context, post, "", true) post, err = th.App.CreatePostAsUser(th.Context, post, "", true)
require.Nil(t, err) require.Nil(t, err)
assert.Equal(t, map[string]interface{}{ assert.Equal(t, map[string]any{
"mention-test": map[string]interface{}{ "mention-test": map[string]any{
"display_name": "Mention Test", "display_name": "Mention Test",
"team_name": th.BasicTeam.Name, "team_name": th.BasicTeam.Name,
}, },
@@ -439,8 +439,8 @@ func TestPostChannelMentions(t *testing.T) {
post.Message = fmt.Sprintf("goodbye, ~%v!", channelToMention.Name) post.Message = fmt.Sprintf("goodbye, ~%v!", channelToMention.Name)
result, err := th.App.UpdatePost(th.Context, post, false) result, err := th.App.UpdatePost(th.Context, post, false)
require.Nil(t, err) require.Nil(t, err)
assert.Equal(t, map[string]interface{}{ assert.Equal(t, map[string]any{
"mention-test": map[string]interface{}{ "mention-test": map[string]any{
"display_name": "Mention Test", "display_name": "Mention Test",
"team_name": th.BasicTeam.Name, "team_name": th.BasicTeam.Name,
}, },
@@ -858,7 +858,7 @@ func TestCreatePost(t *testing.T) {
Description string Description string
Channel *model.Channel Channel *model.Channel
Author string Author string
Assert func(t assert.TestingT, object interface{}, msgAndArgs ...interface{}) bool Assert func(t assert.TestingT, object any, msgAndArgs ...any) bool
}{ }{
{ {
Description: "removes metadata from post for members who cannot read channel", Description: "removes metadata from post for members who cannot read channel",
@@ -1345,7 +1345,7 @@ func TestUpdatePost(t *testing.T) {
Description string Description string
Channel *model.Channel Channel *model.Channel
Author string Author string
Assert func(t assert.TestingT, object interface{}, msgAndArgs ...interface{}) bool Assert func(t assert.TestingT, object any, msgAndArgs ...any) bool
}{ }{
{ {
Description: "removes metadata from post for members who cannot read channel", Description: "removes metadata from post for members who cannot read channel",
@@ -1879,7 +1879,7 @@ func TestCountMentionsFromPost(t *testing.T) {
ChannelId: channel.Id, ChannelId: channel.Id,
Message: "test", Message: "test",
Type: model.PostTypeAddToChannel, Type: model.PostTypeAddToChannel,
Props: map[string]interface{}{ Props: map[string]any{
model.PostPropsAddedUserId: model.NewId(), model.PostPropsAddedUserId: model.NewId(),
}, },
}, channel, false, true) }, channel, false, true)
@@ -1889,7 +1889,7 @@ func TestCountMentionsFromPost(t *testing.T) {
ChannelId: channel.Id, ChannelId: channel.Id,
Message: "test2", Message: "test2",
Type: model.PostTypeAddToChannel, Type: model.PostTypeAddToChannel,
Props: map[string]interface{}{ Props: map[string]any{
model.PostPropsAddedUserId: user2.Id, model.PostPropsAddedUserId: user2.Id,
}, },
}, channel, false, true) }, channel, false, true)
@@ -1899,7 +1899,7 @@ func TestCountMentionsFromPost(t *testing.T) {
ChannelId: channel.Id, ChannelId: channel.Id,
Message: "test3", Message: "test3",
Type: model.PostTypeAddToChannel, Type: model.PostTypeAddToChannel,
Props: map[string]interface{}{ Props: map[string]any{
model.PostPropsAddedUserId: user2.Id, model.PostPropsAddedUserId: user2.Id,
}, },
}, channel, false, true) }, channel, false, true)
@@ -2089,7 +2089,7 @@ func TestCountMentionsFromPost(t *testing.T) {
UserId: user2.Id, UserId: user2.Id,
ChannelId: channel.Id, ChannelId: channel.Id,
Message: fmt.Sprintf("@%s", user2.Username), Message: fmt.Sprintf("@%s", user2.Username),
Props: map[string]interface{}{ Props: map[string]any{
"from_webhook": "true", "from_webhook": "true",
}, },
}, channel, false, true) }, channel, false, true)

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

@@ -14,7 +14,7 @@ type Product interface {
} }
type ProductManifest struct { type ProductManifest struct {
Initializer func(*Server, map[ServiceKey]interface{}) (Product, error) Initializer func(*Server, map[ServiceKey]any) (Product, error)
Dependencies map[ServiceKey]struct{} Dependencies map[ServiceKey]struct{}
} }
@@ -26,7 +26,7 @@ func RegisterProduct(name string, m ProductManifest) {
func (s *Server) initializeProducts( func (s *Server) initializeProducts(
productMap map[string]ProductManifest, productMap map[string]ProductManifest,
serviceMap map[ServiceKey]interface{}, serviceMap map[ServiceKey]any,
) error { ) error {
// create a product map to consume // create a product map to consume
pmap := make(map[string]struct{}) pmap := make(map[string]struct{})

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

@@ -198,7 +198,7 @@ func noticeMatchesConditions(config *model.Config, preferences store.PreferenceS
return true, nil return true, nil
} }
func validateUserConfigEntry(preferences store.PreferenceStore, userID string, key string, expectedValue interface{}) (bool, error) { func validateUserConfigEntry(preferences store.PreferenceStore, userID string, key string, expectedValue any) (bool, error) {
parts := strings.Split(key, ".") parts := strings.Split(key, ".")
if len(parts) != 2 { if len(parts) != 2 {
return false, errors.New("Invalid format of user config. Must be in form of Category.SettingName") return false, errors.New("Invalid format of user config. Must be in form of Category.SettingName")
@@ -213,7 +213,7 @@ func validateUserConfigEntry(preferences store.PreferenceStore, userID string, k
return pref.Value == expectedValue, nil return pref.Value == expectedValue, nil
} }
func validateConfigEntry(conf *model.Config, path string, expectedValue interface{}) bool { func validateConfigEntry(conf *model.Config, path string, expectedValue any) bool {
value, found := config.GetValueByPath(strings.Split(path, "."), *conf) value, found := config.GetValueByPath(strings.Split(path, "."), *conf)
if !found { if !found {
return false return false

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

@@ -114,7 +114,7 @@ func TestNoticeValidation(t *testing.T) {
args: args{ args: args{
notice: &model.ProductNotice{ notice: &model.ProductNotice{
Conditions: model.Conditions{ Conditions: model.Conditions{
ServerConfig: map[string]interface{}{"ServiceSettings.LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache"}, ServerConfig: map[string]any{"ServiceSettings.LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache"},
}, },
}, },
}, },
@@ -126,7 +126,7 @@ func TestNoticeValidation(t *testing.T) {
args: args{ args: args{
notice: &model.ProductNotice{ notice: &model.ProductNotice{
Conditions: model.Conditions{ Conditions: model.Conditions{
ServerConfig: map[string]interface{}{"ServiceSettings.ZZ": "test"}, ServerConfig: map[string]any{"ServiceSettings.ZZ": "test"},
}, },
}, },
}, },
@@ -138,7 +138,7 @@ func TestNoticeValidation(t *testing.T) {
args: args{ args: args{
notice: &model.ProductNotice{ notice: &model.ProductNotice{
Conditions: model.Conditions{ Conditions: model.Conditions{
UserConfig: map[string]interface{}{"Stuff": "test"}, UserConfig: map[string]any{"Stuff": "test"},
}, },
}, },
}, },
@@ -150,7 +150,7 @@ func TestNoticeValidation(t *testing.T) {
args: args{ args: args{
notice: &model.ProductNotice{ notice: &model.ProductNotice{
Conditions: model.Conditions{ Conditions: model.Conditions{
UserConfig: map[string]interface{}{"Stuff.Data": "test"}, UserConfig: map[string]any{"Stuff.Data": "test"},
}, },
}, },
}, },
@@ -162,7 +162,7 @@ func TestNoticeValidation(t *testing.T) {
args: args{ args: args{
notice: &model.ProductNotice{ notice: &model.ProductNotice{
Conditions: model.Conditions{ Conditions: model.Conditions{
UserConfig: map[string]interface{}{"Stuff.Data2": "test"}, UserConfig: map[string]any{"Stuff.Data2": "test"},
}, },
}, },
}, },
@@ -174,7 +174,7 @@ func TestNoticeValidation(t *testing.T) {
args: args{ args: args{
notice: &model.ProductNotice{ notice: &model.ProductNotice{
Conditions: model.Conditions{ Conditions: model.Conditions{
UserConfig: map[string]interface{}{"Stuff.Data3": "stuff"}, UserConfig: map[string]any{"Stuff.Data3": "stuff"},
}, },
}, },
}, },

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

@@ -16,7 +16,7 @@ const (
type productA struct{} type productA struct{}
func newProductA(s *Server, m map[ServiceKey]interface{}) (Product, error) { func newProductA(s *Server, m map[ServiceKey]any) (Product, error) {
m[testSrvKey1] = nil m[testSrvKey1] = nil
return &productA{}, nil return &productA{}, nil
} }
@@ -26,7 +26,7 @@ func (p *productA) Stop() error { return nil }
type productB struct{} type productB struct{}
func newProductB(s *Server, m map[ServiceKey]interface{}) (Product, error) { func newProductB(s *Server, m map[ServiceKey]any) (Product, error) {
m[testSrvKey2] = nil m[testSrvKey2] = nil
return &productB{}, nil return &productB{}, nil
} }
@@ -36,7 +36,7 @@ func (p *productB) Stop() error { return nil }
func TestInitializeProducts(t *testing.T) { func TestInitializeProducts(t *testing.T) {
t.Run("2 products and no circular dependency", func(t *testing.T) { t.Run("2 products and no circular dependency", func(t *testing.T) {
serviceMap := map[ServiceKey]interface{}{ serviceMap := map[ServiceKey]any{
ConfigKey: nil, ConfigKey: nil,
LicenseKey: nil, LicenseKey: nil,
FilestoreKey: nil, FilestoreKey: nil,
@@ -73,7 +73,7 @@ func TestInitializeProducts(t *testing.T) {
}) })
t.Run("2 products and circular dependency", func(t *testing.T) { t.Run("2 products and circular dependency", func(t *testing.T) {
serviceMap := map[ServiceKey]interface{}{ serviceMap := map[ServiceKey]any{
ConfigKey: nil, ConfigKey: nil,
LicenseKey: nil, LicenseKey: nil,
FilestoreKey: nil, FilestoreKey: nil,
@@ -110,7 +110,7 @@ func TestInitializeProducts(t *testing.T) {
}) })
t.Run("2 products and one w/o any dependency", func(t *testing.T) { t.Run("2 products and one w/o any dependency", func(t *testing.T) {
serviceMap := map[ServiceKey]interface{}{ serviceMap := map[ServiceKey]any{
ConfigKey: nil, ConfigKey: nil,
LicenseKey: nil, LicenseKey: nil,
FilestoreKey: nil, FilestoreKey: nil,

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

@@ -45,7 +45,7 @@ func EmptyContext() *Context {
} }
} }
func (c *Context) T(translationID string, args ...interface{}) string { func (c *Context) T(translationID string, args ...any) string {
return c.t(translationID, args...) return c.t(translationID, args...)
} }
func (c *Context) Session() *model.Session { func (c *Context) Session() *model.Session {

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

@@ -108,7 +108,7 @@ func (a *App) AddSamlIdpCertificate(fileData *multipart.FileHeader) *model.AppEr
func (a *App) removeSamlFile(filename string) *model.AppError { func (a *App) removeSamlFile(filename string) *model.AppError {
if err := a.Srv().configStore.RemoveFile(filename); err != nil { if err := a.Srv().configStore.RemoveFile(filename); err != nil {
return model.NewAppError("RemoveSamlFile", "api.admin.remove_certificate.delete.app_error", map[string]interface{}{"Filename": filename}, err.Error(), http.StatusInternalServerError) return model.NewAppError("RemoveSamlFile", "api.admin.remove_certificate.delete.app_error", map[string]any{"Filename": filename}, err.Error(), http.StatusInternalServerError)
} }
return nil return nil

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

@@ -392,7 +392,7 @@ func NewServer(options ...Option) (*Server, error) {
return nil, errors.Wrapf(err, "unable to create teams service") return nil, errors.Wrapf(err, "unable to create teams service")
} }
serviceMap := map[ServiceKey]interface{}{ serviceMap := map[ServiceKey]any{
ChannelKey: &channelsWrapper{srv: s}, ChannelKey: &channelsWrapper{srv: s},
ConfigKey: s.configStore, ConfigKey: s.configStore,
LicenseKey: s.licenseWrapper, LicenseKey: s.licenseWrapper,

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

@@ -75,7 +75,7 @@ func (s *Server) takeInactivityAction() {
mlog.Warn("No SiteURL configured") mlog.Warn("No SiteURL configured")
} }
properties := map[string]interface{}{ properties := map[string]any{
"SiteURL": siteURL, "SiteURL": siteURL,
} }
s.GetTelemetryService().SendTelemetry("inactive_server", properties) s.GetTelemetryService().SendTelemetry("inactive_server", properties)

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

@@ -44,7 +44,7 @@ func (a *App) GetCloudSession(token string) (*model.Session, *model.AppError) {
session.AddProp(model.SessionPropType, model.SessionTypeCloudKey) session.AddProp(model.SessionPropType, model.SessionTypeCloudKey)
return session, nil return session, nil
} }
return nil, model.NewAppError("GetCloudSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized) return nil, model.NewAppError("GetCloudSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized)
} }
func (a *App) GetRemoteClusterSession(token string, remoteId string) (*model.Session, *model.AppError) { func (a *App) GetRemoteClusterSession(token string, remoteId string) (*model.Session, *model.AppError) {
@@ -59,7 +59,7 @@ func (a *App) GetRemoteClusterSession(token string, remoteId string) (*model.Ses
session.AddProp(model.SessionPropType, model.SessionTypeRemoteclusterToken) session.AddProp(model.SessionPropType, model.SessionTypeRemoteclusterToken)
return session, nil return session, nil
} }
return nil, model.NewAppError("GetRemoteClusterSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized) return nil, model.NewAppError("GetRemoteClusterSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "The provided token is invalid", http.StatusUnauthorized)
} }
func (a *App) GetSession(token string) (*model.Session, *model.AppError) { func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
@@ -68,7 +68,7 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
// If we don't have the session we are going to create one with the token eventually. // If we don't have the session we are going to create one with the token eventually.
if session, _ = a.ch.srv.userService.GetSession(token); session != nil { if session, _ = a.ch.srv.userService.GetSession(token); session != nil {
if session.Token != token { if session.Token != token {
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "session token is different from the one in DB", http.StatusUnauthorized) return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "session token is different from the one in DB", http.StatusUnauthorized)
} }
if !session.IsExpired() { if !session.IsExpired() {
@@ -88,12 +88,12 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
} else { } else {
mlog.Warn("Error while creating session for user access token", mlog.Err(appErr)) mlog.Warn("Error while creating session for user access token", mlog.Err(appErr))
} }
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": detailedError}, "", statusCode) return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": detailedError}, "", statusCode)
} }
} }
if session.Id == "" || session.IsExpired() { if session.Id == "" || session.IsExpired() {
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "session is either nil or expired", http.StatusUnauthorized) return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "session is either nil or expired", http.StatusUnauthorized)
} }
if *a.Config().ServiceSettings.SessionIdleTimeoutInMinutes > 0 && if *a.Config().ServiceSettings.SessionIdleTimeoutInMinutes > 0 &&
@@ -116,7 +116,7 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
mlog.Warn("Error while revoking session", mlog.Err(err)) mlog.Warn("Error while revoking session", mlog.Err(err))
} }
}) })
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "idle timeout", http.StatusUnauthorized) return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]any{"Token": token, "Error": ""}, "idle timeout", http.StatusUnauthorized)
} }
} }

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

@@ -97,7 +97,7 @@ func (*HeaderProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
if err != nil { if err != nil {
text := args.T("api.command_channel_header.update_channel.app_error") text := args.T("api.command_channel_header.update_channel.app_error")
if err.Id == "model.channel.is_valid.header.app_error" { if err.Id == "model.channel.is_valid.header.app_error" {
text = args.T("api.command_channel_header.update_channel.max_length", map[string]interface{}{ text = args.T("api.command_channel_header.update_channel.max_length", map[string]any{
"MaxLength": model.ChannelHeaderMaxRunes, "MaxLength": model.ChannelHeaderMaxRunes,
}) })
} }

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

@@ -21,7 +21,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
// Try a public channel *with* permission. // Try a public channel *with* permission.
args := &model.CommandArgs{ args := &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -38,7 +38,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
// Try a public channel *without* permission. // Try a public channel *without* permission.
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -52,7 +52,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
privateChannel := th.createPrivateChannel(th.BasicTeam) privateChannel := th.createPrivateChannel(th.BasicTeam)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: privateChannel.Id, ChannelId: privateChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -64,7 +64,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
// Try a private channel *without* permission. // Try a private channel *without* permission.
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: privateChannel.Id, ChannelId: privateChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -80,7 +80,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
groupChannel := th.createGroupChannel(user1, user2) groupChannel := th.createGroupChannel(user1, user2)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: groupChannel.Id, ChannelId: groupChannel.Id,
UserId: user1.Id, UserId: user1.Id,
} }
@@ -90,7 +90,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
// Try a group channel *without* being a member. // Try a group channel *without* being a member.
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: groupChannel.Id, ChannelId: groupChannel.Id,
UserId: user3.Id, UserId: user3.Id,
} }
@@ -102,7 +102,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
directChannel := th.createDmChannel(user1) directChannel := th.createDmChannel(user1)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: directChannel.Id, ChannelId: directChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -112,7 +112,7 @@ func TestHeaderProviderDoCommand(t *testing.T) {
// Try a direct channel *without* being a member. // Try a direct channel *without* being a member.
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: directChannel.Id, ChannelId: directChannel.Id,
UserId: user2.Id, UserId: user2.Id,
} }

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

@@ -82,7 +82,7 @@ func (*PurposeProvider) DoCommand(a *app.App, c *request.Context, args *model.Co
if err != nil { if err != nil {
text := args.T("api.command_channel_purpose.update_channel.app_error") text := args.T("api.command_channel_purpose.update_channel.app_error")
if err.Id == "model.channel.is_valid.purpose.app_error" { if err.Id == "model.channel.is_valid.purpose.app_error" {
text = args.T("api.command_channel_purpose.update_channel.max_length", map[string]interface{}{ text = args.T("api.command_channel_purpose.update_channel.max_length", map[string]any{
"MaxLength": model.ChannelPurposeMaxRunes, "MaxLength": model.ChannelPurposeMaxRunes,
}) })
} }

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

@@ -21,7 +21,7 @@ func TestPurposeProviderDoCommand(t *testing.T) {
th.addPermissionToRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId) th.addPermissionToRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
args := &model.CommandArgs{ args := &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -38,7 +38,7 @@ func TestPurposeProviderDoCommand(t *testing.T) {
th.removePermissionFromRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId) th.removePermissionFromRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
} }
@@ -51,7 +51,7 @@ func TestPurposeProviderDoCommand(t *testing.T) {
th.addPermissionToRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId) th.addPermissionToRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: privateChannel.Id, ChannelId: privateChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -63,7 +63,7 @@ func TestPurposeProviderDoCommand(t *testing.T) {
th.removePermissionFromRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId) th.removePermissionFromRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: privateChannel.Id, ChannelId: privateChannel.Id,
} }
@@ -77,7 +77,7 @@ func TestPurposeProviderDoCommand(t *testing.T) {
groupChannel := th.createGroupChannel(user1, user2) groupChannel := th.createGroupChannel(user1, user2)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: groupChannel.Id, ChannelId: groupChannel.Id,
} }
@@ -88,7 +88,7 @@ func TestPurposeProviderDoCommand(t *testing.T) {
directChannel := th.createDmChannel(user1) directChannel := th.createDmChannel(user1)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: directChannel.Id, ChannelId: directChannel.Id,
} }

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

@@ -73,14 +73,14 @@ func (*RenameProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
} }
} else if len(message) > model.ChannelNameMaxLength { } else if len(message) > model.ChannelNameMaxLength {
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_channel_rename.too_long.app_error", map[string]interface{}{ Text: args.T("api.command_channel_rename.too_long.app_error", map[string]any{
"Length": model.ChannelNameMaxLength, "Length": model.ChannelNameMaxLength,
}), }),
ResponseType: model.CommandResponseTypeEphemeral, ResponseType: model.CommandResponseTypeEphemeral,
} }
} else if len(message) < model.ChannelNameMinLength { } else if len(message) < model.ChannelNameMinLength {
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_channel_rename.too_short.app_error", map[string]interface{}{ Text: args.T("api.command_channel_rename.too_short.app_error", map[string]any{
"Length": model.ChannelNameMinLength, "Length": model.ChannelNameMinLength,
}), }),
ResponseType: model.CommandResponseTypeEphemeral, ResponseType: model.CommandResponseTypeEphemeral,

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

@@ -20,7 +20,7 @@ func TestRenameProviderDoCommand(t *testing.T) {
rp := RenameProvider{} rp := RenameProvider{}
args := &model.CommandArgs{ args := &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -41,7 +41,7 @@ func TestRenameProviderDoCommand(t *testing.T) {
th.removePermissionFromRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId) th.removePermissionFromRole(model.PermissionManagePublicChannelProperties.Id, model.ChannelUserRoleId)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -55,7 +55,7 @@ func TestRenameProviderDoCommand(t *testing.T) {
th.addPermissionToRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId) th.addPermissionToRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: privateChannel.Id, ChannelId: privateChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -67,7 +67,7 @@ func TestRenameProviderDoCommand(t *testing.T) {
th.removePermissionFromRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId) th.removePermissionFromRole(model.PermissionManagePrivateChannelProperties.Id, model.ChannelUserRoleId)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: privateChannel.Id, ChannelId: privateChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -82,7 +82,7 @@ func TestRenameProviderDoCommand(t *testing.T) {
groupChannel := th.createGroupChannel(user1, user2) groupChannel := th.createGroupChannel(user1, user2)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: groupChannel.Id, ChannelId: groupChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }
@@ -94,7 +94,7 @@ func TestRenameProviderDoCommand(t *testing.T) {
directChannel := th.createDmChannel(user1) directChannel := th.createDmChannel(user1)
args = &model.CommandArgs{ args = &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: directChannel.Id, ChannelId: directChannel.Id,
UserId: th.BasicUser.Id, UserId: th.BasicUser.Id,
} }

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

@@ -12,7 +12,7 @@ import (
func TestCodeProviderDoCommand(t *testing.T) { func TestCodeProviderDoCommand(t *testing.T) {
cp := CodeProvider{} cp := CodeProvider{}
args := &model.CommandArgs{ args := &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
} }
for msg, expected := range map[string]string{ for msg, expected := range map[string]string{

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

@@ -68,7 +68,7 @@ func (*CustomStatusProvider) DoCommand(a *app.App, c *request.Context, args *mod
return &model.CommandResponse{ return &model.CommandResponse{
ResponseType: model.CommandResponseTypeEphemeral, ResponseType: model.CommandResponseTypeEphemeral,
Text: args.T("api.command_custom_status.success", map[string]interface{}{ Text: args.T("api.command_custom_status.success", map[string]any{
"EmojiName": ":" + customStatus.Emoji + ":", "EmojiName": ":" + customStatus.Emoji + ":",
"StatusMessage": customStatus.Text, "StatusMessage": customStatus.Text,
}), }),

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

@@ -73,7 +73,7 @@ func (*groupmsgProvider) DoCommand(a *app.App, c *request.Context, args *model.C
} }
if len(invalidUsernames) > 0 { if len(invalidUsernames) > 0 {
invalidUsersString := map[string]interface{}{ invalidUsersString := map[string]any{
"Users": "@" + strings.Join(invalidUsernames, ", @"), "Users": "@" + strings.Join(invalidUsernames, ", @"),
} }
return &model.CommandResponse{ return &model.CommandResponse{
@@ -87,7 +87,7 @@ func (*groupmsgProvider) DoCommand(a *app.App, c *request.Context, args *model.C
} }
if len(targetUsersSlice) < model.ChannelGroupMinUsers { if len(targetUsersSlice) < model.ChannelGroupMinUsers {
minUsers := map[string]interface{}{ minUsers := map[string]any{
"MinUsers": model.ChannelGroupMinUsers - 1, "MinUsers": model.ChannelGroupMinUsers - 1,
} }
return &model.CommandResponse{ return &model.CommandResponse{
@@ -97,7 +97,7 @@ func (*groupmsgProvider) DoCommand(a *app.App, c *request.Context, args *model.C
} }
if len(targetUsersSlice) > model.ChannelGroupMaxUsers { if len(targetUsersSlice) > model.ChannelGroupMaxUsers {
maxUsers := map[string]interface{}{ maxUsers := map[string]any{
"MaxUsers": model.ChannelGroupMaxUsers - 1, "MaxUsers": model.ChannelGroupMaxUsers - 1,
} }
return &model.CommandResponse{ return &model.CommandResponse{

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

@@ -75,7 +75,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
if channelToJoin, err = a.GetChannelByName(targetChannelName, args.TeamId, false); err != nil { if channelToJoin, err = a.GetChannelByName(targetChannelName, args.TeamId, false); err != nil {
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_invite.channel.error", map[string]interface{}{ Text: args.T("api.command_invite.channel.error", map[string]any{
"Channel": targetChannelName, "Channel": targetChannelName,
}), }),
ResponseType: model.CommandResponseTypeEphemeral, ResponseType: model.CommandResponseTypeEphemeral,
@@ -96,7 +96,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
case model.ChannelTypeOpen: case model.ChannelTypeOpen:
if !a.HasPermissionToChannel(args.UserId, channelToJoin.Id, model.PermissionManagePublicChannelMembers) { if !a.HasPermissionToChannel(args.UserId, channelToJoin.Id, model.PermissionManagePublicChannelMembers) {
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_invite.permission.app_error", map[string]interface{}{ Text: args.T("api.command_invite.permission.app_error", map[string]any{
"User": userProfile.Username, "User": userProfile.Username,
"Channel": channelToJoin.Name, "Channel": channelToJoin.Name,
}), }),
@@ -108,7 +108,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
if _, err = a.GetChannelMember(context.Background(), channelToJoin.Id, args.UserId); err == nil { if _, err = a.GetChannelMember(context.Background(), channelToJoin.Id, args.UserId); err == nil {
// User doing the inviting is a member of the channel. // User doing the inviting is a member of the channel.
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_invite.permission.app_error", map[string]interface{}{ Text: args.T("api.command_invite.permission.app_error", map[string]any{
"User": userProfile.Username, "User": userProfile.Username,
"Channel": channelToJoin.Name, "Channel": channelToJoin.Name,
}), }),
@@ -117,7 +117,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
} }
// User doing the inviting is *not* a member of the channel. // User doing the inviting is *not* a member of the channel.
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_invite.private_channel.app_error", map[string]interface{}{ Text: args.T("api.command_invite.private_channel.app_error", map[string]any{
"Channel": channelToJoin.Name, "Channel": channelToJoin.Name,
}), }),
ResponseType: model.CommandResponseTypeEphemeral, ResponseType: model.CommandResponseTypeEphemeral,
@@ -134,7 +134,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
_, err = a.GetChannelMember(context.Background(), channelToJoin.Id, userProfile.Id) _, err = a.GetChannelMember(context.Background(), channelToJoin.Id, userProfile.Id)
if err == nil { if err == nil {
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_invite.user_already_in_channel.app_error", map[string]interface{}{ Text: args.T("api.command_invite.user_already_in_channel.app_error", map[string]any{
"User": userProfile.Username, "User": userProfile.Username,
}), }),
ResponseType: model.CommandResponseTypeEphemeral, ResponseType: model.CommandResponseTypeEphemeral,
@@ -149,7 +149,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
text = args.T("api.command_invite.group_constrained_user_denied") text = args.T("api.command_invite.group_constrained_user_denied")
} else if err.Id == "app.team.get_member.missing.app_error" || } else if err.Id == "app.team.get_member.missing.app_error" ||
err.Id == "api.channel.add_user.to.channel.failed.deleted.app_error" { err.Id == "api.channel.add_user.to.channel.failed.deleted.app_error" {
text = args.T("api.command_invite.user_not_in_team.app_error", map[string]interface{}{ text = args.T("api.command_invite.user_not_in_team.app_error", map[string]any{
"Username": userProfile.Username, "Username": userProfile.Username,
}) })
} else { } else {
@@ -163,7 +163,7 @@ func (*InviteProvider) DoCommand(a *app.App, c *request.Context, args *model.Com
if args.ChannelId != channelToJoin.Id { if args.ChannelId != channelToJoin.Id {
return &model.CommandResponse{ return &model.CommandResponse{
Text: args.T("api.command_invite.success", map[string]interface{}{ Text: args.T("api.command_invite.success", map[string]any{
"User": userProfile.Username, "User": userProfile.Username,
"Channel": channelToJoin.Name, "Channel": channelToJoin.Name,
}), }),

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

@@ -26,7 +26,7 @@ func TestInvitePeopleProvider(t *testing.T) {
// Test without required permissions // Test without required permissions
args := &model.CommandArgs{ args := &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s }, T: func(s string, args ...any) string { return s },
ChannelId: th.BasicChannel.Id, ChannelId: th.BasicChannel.Id,
TeamId: th.BasicTeam.Id, TeamId: th.BasicTeam.Id,
UserId: notTeamUser.Id, UserId: notTeamUser.Id,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше