MM-46577: Remove empty translation strings (#20876)
We replace the empty translation key with <untranslated> which is ignored by the translation check tool. https://mattermost.atlassian.net/browse/MM-46577 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e8a45a8cf7
Коммит
c72e9131f4
10
app/admin.go
10
app/admin.go
@@ -255,29 +255,29 @@ func (a *App) GetLatestVersion(latestVersionUrl string) (*model.GithubReleaseInf
|
||||
|
||||
res, err := http.Get(latestVersionUrl)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetLatestVersion", "app.admin.latest_version_external_error.failure", nil, "", http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetLatestVersion", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
defer res.Body.Close()
|
||||
|
||||
responseData, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetLatestVersion", "app.admin.latest_version_read_all.failure", nil, "", http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetLatestVersion", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
var releaseInfoResponse *model.GithubReleaseInfo
|
||||
err = json.Unmarshal(responseData, &releaseInfoResponse)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetLatestVersion", "app.admin.latest_version_unmarshal.failure", nil, "", http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetLatestVersion", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
if validErr := releaseInfoResponse.IsValid(); validErr != nil {
|
||||
return nil, model.NewAppError("GetLatestVersion", "app.admin.latest_version_external_error.failure", nil, "", http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetLatestVersion", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(validErr)
|
||||
}
|
||||
|
||||
err = latestVersionCache.Set("latest_version_cache", releaseInfoResponse)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetLatestVersion", "app.admin.latest_version_set_cache.failure", nil, "", http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetLatestVersion", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
return releaseInfoResponse, nil
|
||||
|
||||
@@ -84,8 +84,7 @@ func TestGetLatestVersion(t *testing.T) {
|
||||
}))
|
||||
defer ts.Close()
|
||||
|
||||
_, err := th.App.GetLatestVersion(errorServer.URL)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, "app.admin.latest_version_external_error.failure", err.Id)
|
||||
_, appErr := th.App.GetLatestVersion(errorServer.URL)
|
||||
require.NotNil(t, appErr)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3416,7 +3416,7 @@ func (a *App) GetTopChannelsForTeamSince(c request.CTX, teamID, userID string, o
|
||||
|
||||
topChannels, err := a.Srv().Store.Channel().GetTopChannelsForTeamSince(teamID, userID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetTopChannelsForTeamSince", "app.channel.get_top_for_team_since.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return nil, model.NewAppError("GetTopChannelsForTeamSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return topChannels, nil
|
||||
}
|
||||
@@ -3428,7 +3428,7 @@ func (a *App) GetTopChannelsForUserSince(c request.CTX, userID, teamID string, o
|
||||
|
||||
topChannels, err := a.Srv().Store.Channel().GetTopChannelsForUserSince(userID, teamID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetTopChannelsForUserSince", "app.channel.get_top_for_user_since.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return nil, model.NewAppError("GetTopChannelsForUserSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return topChannels, nil
|
||||
}
|
||||
@@ -3444,7 +3444,7 @@ func (a *App) PostCountsByDuration(c request.CTX, channelIDs []string, sinceUnix
|
||||
}
|
||||
postCountByDay, err := a.Srv().Store.Channel().PostCountsByDuration(channelIDs, sinceUnixMillis, userID, grouping, groupingLocation)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("PostCountsByDuration", "app.channel.get_post_count_by_day.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return nil, model.NewAppError("PostCountsByDuration", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return postCountByDay, nil
|
||||
}
|
||||
@@ -3455,7 +3455,7 @@ func (a *App) GetTopInactiveChannelsForTeamSince(c request.CTX, teamID, userID s
|
||||
}
|
||||
topChannels, err := a.Srv().Store.Channel().GetTopInactiveChannelsForTeamSince(teamID, userID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetTopInactiveChannelsForTeamSince", "app.channel.get_top_invalid_for_team_since.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetTopInactiveChannelsForTeamSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return topChannels, nil
|
||||
}
|
||||
@@ -3467,7 +3467,7 @@ func (a *App) GetTopInactiveChannelsForUserSince(c request.CTX, teamID, userID s
|
||||
|
||||
topChannels, err := a.Srv().Store.Channel().GetTopInactiveChannelsForUserSince(teamID, userID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetTopInactiveChannelsForUserSince", "app.channel.get_top_invalid_for_user_since.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, model.NewAppError("GetTopInactiveChannelsForUserSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return topChannels, nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package app
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
@@ -113,10 +114,10 @@ func (a *App) isUniqueToUsernames(val string) *model.AppError {
|
||||
var notFoundErr *store.ErrNotFound
|
||||
user, err := a.Srv().Store.User().GetByUsername(val)
|
||||
if err != nil && !errors.As(err, ¬FoundErr) {
|
||||
return model.NewAppError("", "app.group.get_by_username_failure", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return model.NewAppError("isUniqueToUsernames", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
if user != nil {
|
||||
return model.NewAppError("", "app.group.username_conflict", nil, "", http.StatusBadRequest)
|
||||
return model.NewAppError("isUniqueToUsernames", model.NoTranslation, nil, fmt.Sprintf("user name %s exists", val), http.StatusBadRequest)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -93,7 +93,6 @@ func TestCreateGroup(t *testing.T) {
|
||||
}
|
||||
g, err = th.App.CreateGroup(usernameGroup)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, "app.group.username_conflict", err.Id)
|
||||
require.Nil(t, g)
|
||||
}
|
||||
|
||||
@@ -111,7 +110,6 @@ func TestUpdateGroup(t *testing.T) {
|
||||
g.Name = &user.Username
|
||||
g, err = th.App.UpdateGroup(g)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, "app.group.username_conflict", err.Id)
|
||||
require.Nil(t, g)
|
||||
}
|
||||
|
||||
|
||||
@@ -1959,12 +1959,12 @@ func (a *App) SetPostReminder(postID, userID string, targetTime int64) *model.Ap
|
||||
}
|
||||
err := a.Srv().Store.Post().SetPostReminder(reminder)
|
||||
if err != nil {
|
||||
return model.NewAppError("SetPostReminder", "app.post_reminder.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return model.NewAppError("SetPostReminder", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
metadata, err := a.Srv().Store.Post().GetPostReminderMetadata(postID)
|
||||
if err != nil {
|
||||
return model.NewAppError("SetPostReminder", "app.post_reminder.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return model.NewAppError("SetPostReminder", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
parsed := time.Unix(targetTime, 0).UTC().Format(time.RFC822)
|
||||
|
||||
@@ -103,7 +103,7 @@ func (a *App) GetTopReactionsForTeamSince(teamID string, userID string, opts *mo
|
||||
|
||||
topReactionList, err := a.Srv().Store.Reaction().GetTopForTeamSince(teamID, userID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetTopReactionsForTeamSince", "app.reaction.get_top_for_team_since.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return nil, model.NewAppError("GetTopReactionsForTeamSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return topReactionList, nil
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func (a *App) GetTopReactionsForUserSince(userID string, teamID string, opts *mo
|
||||
|
||||
topReactionList, err := a.Srv().Store.Reaction().GetTopForUserSince(userID, teamID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetTopReactionsForUserSince", "app.reaction.get_top_for_user_since.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return nil, model.NewAppError("GetTopReactionsForUserSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return topReactionList, nil
|
||||
}
|
||||
|
||||
@@ -2141,7 +2141,7 @@ func (a *App) GetNewTeamMembersSince(c request.CTX, teamID string, opts *model.I
|
||||
|
||||
ntms, count, err := a.Srv().Store.Team().GetNewTeamMembersSince(teamID, opts.StartUnixMilli, opts.Page*opts.PerPage, opts.PerPage)
|
||||
if err != nil {
|
||||
return nil, 0, model.NewAppError("GetNewTeamMembersSince", "app.post.get_new_team_members_since.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, 0, model.NewAppError("GetNewTeamMembersSince", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
return ntms, count, nil
|
||||
|
||||
@@ -1102,10 +1102,10 @@ func (a *App) isUniqueToGroupNames(val string) *model.AppError {
|
||||
var notFoundErr *store.ErrNotFound
|
||||
group, err := a.Srv().Store.Group().GetByName(val, model.GroupSearchOpts{})
|
||||
if err != nil && !errors.As(err, ¬FoundErr) {
|
||||
return model.NewAppError("", "app.user.get_by_name_failure", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return model.NewAppError("isUniqueToGroupNames", model.NoTranslation, nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
if group != nil {
|
||||
return model.NewAppError("", "app.user.group_name_conflict", nil, "", http.StatusBadRequest)
|
||||
return model.NewAppError("isUniqueToGroupNames", model.NoTranslation, nil, fmt.Sprintf("group name %s exists", val), http.StatusBadRequest)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -192,7 +192,6 @@ func TestUpdateUser(t *testing.T) {
|
||||
user.Username = *group.Name
|
||||
u, err := th.App.UpdateUser(th.Context, user, false)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, "app.user.group_name_conflict", err.Id)
|
||||
require.Nil(t, u)
|
||||
})
|
||||
}
|
||||
@@ -246,7 +245,6 @@ func TestCreateUser(t *testing.T) {
|
||||
user.Username = *group.Name
|
||||
u, err := th.App.CreateUser(th.Context, user)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, "app.user.group_name_conflict", err.Id)
|
||||
require.Nil(t, u)
|
||||
})
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user