MM-21336: Improve channel rename restrictions (#13441)
* MM-21336: Improve channel rename restrictions Non-direct channels should not have __ in them. * Fix order of i18n extraction * Incorporate review comments Use a more relaxed check by actually checking for valid userIds. * Improve error message
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
69ab1ea1e4
Коммит
e826055519
@@ -743,6 +743,7 @@ func TestRenameChannel(t *testing.T) {
|
||||
Name string
|
||||
Channel *model.Channel
|
||||
ExpectError bool
|
||||
ChannelName string
|
||||
ExpectedName string
|
||||
ExpectedDisplayName string
|
||||
}{
|
||||
@@ -751,19 +752,30 @@ func TestRenameChannel(t *testing.T) {
|
||||
th.createChannel(th.BasicTeam, model.CHANNEL_OPEN),
|
||||
false,
|
||||
"newchannelname",
|
||||
"newchannelname",
|
||||
"New Display Name",
|
||||
},
|
||||
{
|
||||
"Fail on rename open channel with bad name",
|
||||
th.createChannel(th.BasicTeam, model.CHANNEL_OPEN),
|
||||
true,
|
||||
"6zii9a9g6pruzj451x3esok54h__wr4j4g8zqtnhmkw771pfpynqwo",
|
||||
"",
|
||||
"",
|
||||
},
|
||||
{
|
||||
"Fail on rename direct message channel",
|
||||
th.CreateDmChannel(th.BasicUser2),
|
||||
true,
|
||||
"newchannelname",
|
||||
"",
|
||||
"",
|
||||
},
|
||||
{
|
||||
"Fail on rename direct message channel",
|
||||
"Fail on rename group message channel",
|
||||
th.CreateGroupChannel(th.BasicUser2, th.CreateUser()),
|
||||
true,
|
||||
"newchannelname",
|
||||
"",
|
||||
"",
|
||||
},
|
||||
@@ -771,7 +783,7 @@ func TestRenameChannel(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
channel, err := th.App.RenameChannel(tc.Channel, "newchannelname", "New Display Name")
|
||||
channel, err := th.App.RenameChannel(tc.Channel, tc.ChannelName, "New Display Name")
|
||||
if tc.ExpectError {
|
||||
assert.NotNil(t, err)
|
||||
} else {
|
||||
|
||||
Ссылка в новой задаче
Block a user