Replacing interface{} with any everywhere (except generated mocks) (#29446)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a21d470bee
Коммит
d316df6d28
@@ -88,7 +88,7 @@ func (a *App) MakeAuditRecord(rctx request.CTX, event string, initialStatus stri
|
||||
rec := &audit.Record{
|
||||
EventName: event,
|
||||
Status: initialStatus,
|
||||
Meta: map[string]interface{}{
|
||||
Meta: map[string]any{
|
||||
audit.KeyAPIPath: "",
|
||||
audit.KeyClusterID: a.GetClusterId(),
|
||||
},
|
||||
@@ -100,9 +100,9 @@ func (a *App) MakeAuditRecord(rctx request.CTX, event string, initialStatus stri
|
||||
XForwardedFor: "",
|
||||
},
|
||||
EventData: audit.EventData{
|
||||
Parameters: map[string]interface{}{},
|
||||
PriorState: map[string]interface{}{},
|
||||
ResultState: map[string]interface{}{},
|
||||
Parameters: map[string]any{},
|
||||
PriorState: map[string]any{},
|
||||
ResultState: map[string]any{},
|
||||
ObjectType: "",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (a *App) UpsertDraft(c request.CTX, draft *model.Draft, connectionID string
|
||||
// Check that channel exists and has not been deleted
|
||||
channel, errCh := a.Srv().Store().Channel().Get(draft.ChannelId, true)
|
||||
if errCh != nil {
|
||||
err := model.NewAppError("CreateDraft", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "draft.channel_id"}, "", http.StatusBadRequest).Wrap(errCh)
|
||||
err := model.NewAppError("CreateDraft", "api.context.invalid_param.app_error", map[string]any{"Name": "draft.channel_id"}, "", http.StatusBadRequest).Wrap(errCh)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ func (a *App) elasticsearchChannelIndexCheck() {
|
||||
}
|
||||
|
||||
// TODO include a link to changelog
|
||||
postMessage := i18n.T("app.channel.elasticsearch_channel_index.notify_admin.message", map[string]interface{}{"ElasticsearchSection": elasticsearchSettingsSectionLink})
|
||||
postMessage := i18n.T("app.channel.elasticsearch_channel_index.notify_admin.message", map[string]any{"ElasticsearchSection": elasticsearchSettingsSectionLink})
|
||||
|
||||
for _, sysAdmin := range sysAdmins {
|
||||
var channel *model.Channel
|
||||
|
||||
@@ -1512,7 +1512,7 @@ func (a *App) GetLastAccessibleFileTime() (int64, *model.AppError) {
|
||||
|
||||
lastAccessibleFileTime, err := strconv.ParseInt(system.Value, 10, 64)
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("GetLastAccessibleFileTime", "common.parse_error_int64", map[string]interface{}{"Value": system.Value}, "", http.StatusInternalServerError).Wrap(err)
|
||||
return 0, model.NewAppError("GetLastAccessibleFileTime", "common.parse_error_int64", map[string]any{"Value": system.Value}, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
return lastAccessibleFileTime, nil
|
||||
|
||||
@@ -127,7 +127,7 @@ func (a *App) isUniqueToUsernames(val string) *model.AppError {
|
||||
return model.NewAppError("isUniqueToUsernames", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
if user != nil {
|
||||
return model.NewAppError("isUniqueToUsernames", "app.group.username_conflict", map[string]interface{}{"Username": val}, "", http.StatusBadRequest)
|
||||
return model.NewAppError("isUniqueToUsernames", "app.group.username_conflict", map[string]any{"Username": val}, "", http.StatusBadRequest)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -135,14 +135,14 @@ func (a *App) upgradePlanAdminNotifyPost(c request.CTX, workspaceName string, us
|
||||
props := make(model.StringInterface)
|
||||
T := i18n.GetUserTranslations(admin.Locale)
|
||||
|
||||
message := T("app.cloud.upgrade_plan_bot_message", map[string]interface{}{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName})
|
||||
message := T("app.cloud.upgrade_plan_bot_message", map[string]any{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName})
|
||||
if len(userBasedData) == 1 {
|
||||
message = T("app.cloud.upgrade_plan_bot_message_single", map[string]interface{}{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName}) // todo (allan): investigate if translations library can do this
|
||||
message = T("app.cloud.upgrade_plan_bot_message_single", map[string]any{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName}) // todo (allan): investigate if translations library can do this
|
||||
}
|
||||
if trial {
|
||||
message = T("app.cloud.trial_plan_bot_message", map[string]interface{}{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName})
|
||||
message = T("app.cloud.trial_plan_bot_message", map[string]any{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName})
|
||||
if len(userBasedData) == 1 {
|
||||
message = T("app.cloud.trial_plan_bot_message_single", map[string]interface{}{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName})
|
||||
message = T("app.cloud.trial_plan_bot_message_single", map[string]any{"UsersNum": len(userBasedData), "WorkspaceName": workspaceName})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,11 +114,11 @@ func (ps *PlatformService) ReloadConfig() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ps *PlatformService) GetEnvironmentOverridesWithFilter(filter func(reflect.StructField) bool) map[string]interface{} {
|
||||
func (ps *PlatformService) GetEnvironmentOverridesWithFilter(filter func(reflect.StructField) bool) map[string]any {
|
||||
return ps.configStore.GetEnvironmentOverridesWithFilter(filter)
|
||||
}
|
||||
|
||||
func (ps *PlatformService) GetEnvironmentOverrides() map[string]interface{} {
|
||||
func (ps *PlatformService) GetEnvironmentOverrides() map[string]any {
|
||||
return ps.configStore.GetEnvironmentOverrides()
|
||||
}
|
||||
|
||||
|
||||
@@ -1597,7 +1597,7 @@ func (a *App) GetLastAccessiblePostTime() (int64, *model.AppError) {
|
||||
|
||||
lastAccessiblePostTime, err := strconv.ParseInt(system.Value, 10, 64)
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("GetLastAccessiblePostTime", "common.parse_error_int64", map[string]interface{}{"Value": system.Value}, "", http.StatusInternalServerError).Wrap(err)
|
||||
return 0, model.NewAppError("GetLastAccessiblePostTime", "common.parse_error_int64", map[string]any{"Value": system.Value}, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
return lastAccessiblePostTime, nil
|
||||
|
||||
@@ -451,7 +451,7 @@ func (a *App) notifyUser(rctx request.CTX, userId string, userFailedMessages []*
|
||||
var messageBuilder strings.Builder
|
||||
|
||||
totalFailedMessages := len(userFailedMessages)
|
||||
messageHeader := T("app.scheduled_post.failed_messages", map[string]interface{}{
|
||||
messageHeader := T("app.scheduled_post.failed_messages", map[string]any{
|
||||
"Count": totalFailedMessages,
|
||||
})
|
||||
messageBuilder.WriteString(messageHeader)
|
||||
@@ -461,7 +461,7 @@ func (a *App) notifyUser(rctx request.CTX, userId string, userFailedMessages []*
|
||||
channelName := channelNames[key.ChannelId]
|
||||
errorReason := getErrorReason(T, key.ErrorCode)
|
||||
|
||||
detailedMessage := T("app.scheduled_post.failed_message_detail", map[string]interface{}{
|
||||
detailedMessage := T("app.scheduled_post.failed_message_detail", map[string]any{
|
||||
"Count": count,
|
||||
"ChannelName": channelName,
|
||||
"ErrorReason": errorReason,
|
||||
|
||||
@@ -384,7 +384,7 @@ func TestHandleFailedScheduledPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
T := i18n.GetUserTranslations(user.Locale)
|
||||
messageHeader := T("app.scheduled_post.failed_messages", map[string]interface{}{
|
||||
messageHeader := T("app.scheduled_post.failed_messages", map[string]any{
|
||||
"Count": len(userFailedMessages),
|
||||
})
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ func (*ExportLinkProvider) DoCommand(a *app.App, c request.CTX, args *model.Comm
|
||||
}
|
||||
|
||||
// return link
|
||||
return &model.CommandResponse{ResponseType: model.CommandResponseTypeEphemeral, Text: args.T("api.command_exportlink.link.text", map[string]interface{}{
|
||||
return &model.CommandResponse{ResponseType: model.CommandResponseTypeEphemeral, Text: args.T("api.command_exportlink.link.text", map[string]any{
|
||||
"Link": res.URL,
|
||||
"Expiration": res.Expiration.String(),
|
||||
})}
|
||||
|
||||
@@ -261,7 +261,7 @@ func (a *App) createUserOrGuest(c request.CTX, user *model.User, guest bool) (*m
|
||||
case errors.Is(nErr, users.AcceptedDomainError):
|
||||
return nil, model.NewAppError("createUserOrGuest", "api.user.create_user.accepted_domain.app_error", nil, "", http.StatusBadRequest).Wrap(nErr)
|
||||
case errors.As(nErr, &nfErr):
|
||||
return nil, model.NewAppError("createUserOrGuest", nfErr.Id(), map[string]interface{}{"Min": *a.Config().PasswordSettings.MinimumLength}, "", http.StatusBadRequest)
|
||||
return nil, model.NewAppError("createUserOrGuest", nfErr.Id(), map[string]any{"Min": *a.Config().PasswordSettings.MinimumLength}, "", http.StatusBadRequest)
|
||||
case errors.Is(nErr, users.UserStoreIsEmptyError):
|
||||
return nil, model.NewAppError("createUserOrGuest", "app.user.store_is_empty.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
|
||||
case errors.As(nErr, &invErr):
|
||||
|
||||
Ссылка в новой задаче
Block a user