MM-22678 Use more user-friendly errors for channel commands (#17520)

* MM-22678 Use more user-friendly errors for channel commands

* Update text from ticket

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Harrison Healey
2021-04-28 15:01:44 -04:00
коммит произвёл GitHub
родитель 6af032d06a
Коммит 3c162999a5
3 изменённых файлов: 26 добавлений и 4 удалений

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

@@ -94,8 +94,15 @@ func (*HeaderProvider) DoCommand(a *app.App, args *model.CommandArgs, message st
_, err = a.PatchChannel(channel, patch, args.UserId)
if err != nil {
text := args.T("api.command_channel_header.update_channel.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{}{
"MaxLength": model.CHANNEL_HEADER_MAX_RUNES,
})
}
return &model.CommandResponse{
Text: args.T("api.command_channel_header.update_channel.app_error"),
Text: text,
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
}
}

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

@@ -79,8 +79,15 @@ func (*PurposeProvider) DoCommand(a *app.App, args *model.CommandArgs, message s
_, err = a.PatchChannel(channel, patch, args.UserId)
if err != nil {
text := args.T("api.command_channel_purpose.update_channel.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{}{
"MaxLength": model.CHANNEL_PURPOSE_MAX_RUNES,
})
}
return &model.CommandResponse{
Text: args.T("api.command_channel_purpose.update_channel.app_error"),
Text: text,
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
}
}

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

@@ -629,7 +629,11 @@
},
{
"id": "api.command_channel_header.update_channel.app_error",
"translation": "Error to update the current channel."
"translation": "Error updating the channel header."
},
{
"id": "api.command_channel_header.update_channel.max_length",
"translation": "The text entered exceeds the character limit. The channel header is limited to {{.MaxLength}} characters."
},
{
"id": "api.command_channel_purpose.channel.app_error",
@@ -661,7 +665,11 @@
},
{
"id": "api.command_channel_purpose.update_channel.app_error",
"translation": "Error to update the current channel."
"translation": "Error updating the channel purpose."
},
{
"id": "api.command_channel_purpose.update_channel.max_length",
"translation": "The text entered exceeds the character limit. The channel purpose is limited to {{.MaxLength}} characters."
},
{
"id": "api.command_channel_remove.channel.app_error",