MM-16115: Channel name max length in /rename to match UI. (#11114)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
059eecc696
Коммит
663977d71a
@@ -67,10 +67,10 @@ func (me *RenameProvider) DoCommand(a *App, args *model.CommandArgs, message str
|
||||
Text: args.T("api.command_channel_rename.message.app_error"),
|
||||
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
|
||||
}
|
||||
} else if len(message) > model.CHANNEL_NAME_UI_MAX_LENGTH {
|
||||
} else if len(message) > model.CHANNEL_NAME_MAX_LENGTH {
|
||||
return &model.CommandResponse{
|
||||
Text: args.T("api.command_channel_rename.too_long.app_error", map[string]interface{}{
|
||||
"Length": model.CHANNEL_NAME_UI_MAX_LENGTH,
|
||||
"Length": model.CHANNEL_NAME_MAX_LENGTH,
|
||||
}),
|
||||
ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -24,13 +25,13 @@ func TestRenameProviderDoCommand(t *testing.T) {
|
||||
Session: model.Session{UserId: th.BasicUser.Id, TeamMembers: []*model.TeamMember{{TeamId: th.BasicTeam.Id, Roles: model.TEAM_USER_ROLE_ID}}},
|
||||
}
|
||||
|
||||
// Blank text is a success
|
||||
// Table Test for basic cases. Blank text in response indicates success
|
||||
for msg, expected := range map[string]string{
|
||||
"": "api.command_channel_rename.message.app_error",
|
||||
"o": "api.command_channel_rename.too_short.app_error",
|
||||
"joram": "",
|
||||
"1234567890123456789012": "",
|
||||
"12345678901234567890123": "api.command_channel_rename.too_long.app_error",
|
||||
"": "api.command_channel_rename.message.app_error",
|
||||
"o": "api.command_channel_rename.too_short.app_error",
|
||||
"joram": "",
|
||||
"More than 22 chars but less than 64": "",
|
||||
strings.Repeat("12345", 13): "api.command_channel_rename.too_long.app_error",
|
||||
} {
|
||||
actual := rp.DoCommand(th.App, args, msg).Text
|
||||
assert.Equal(t, expected, actual)
|
||||
|
||||
@@ -25,7 +25,6 @@ const (
|
||||
CHANNEL_DISPLAY_NAME_MAX_RUNES = 64
|
||||
CHANNEL_NAME_MIN_LENGTH = 2
|
||||
CHANNEL_NAME_MAX_LENGTH = 64
|
||||
CHANNEL_NAME_UI_MAX_LENGTH = 22
|
||||
CHANNEL_HEADER_MAX_RUNES = 1024
|
||||
CHANNEL_PURPOSE_MAX_RUNES = 250
|
||||
CHANNEL_CACHE_SIZE = 25000
|
||||
|
||||
Ссылка в новой задаче
Block a user