MM-31105 /Join <channel name> is case sensitive (#16903)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
23d51ed1f2
Коммит
c64959b439
@@ -8,6 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
_ "github.com/mattermost/mattermost-server/v5/app/slashcommands"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v5/model"
|
"github.com/mattermost/mattermost-server/v5/model"
|
||||||
@@ -128,6 +129,13 @@ func testJoinCommands(t *testing.T, alias string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
require.True(t, found, "did not join channel")
|
require.True(t, found, "did not join channel")
|
||||||
|
|
||||||
|
// test case insensitively
|
||||||
|
channel4 := &model.Channel{DisplayName: "BB", Name: "bb" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
|
||||||
|
channel4 = Client.Must(Client.CreateChannel(channel4)).(*model.Channel)
|
||||||
|
Client.Must(Client.RemoveUserFromChannel(channel4.Id, th.BasicUser.Id))
|
||||||
|
rs7 := Client.Must(Client.ExecuteCommand(channel0.Id, "/"+alias+" "+strings.ToUpper(channel4.Name))).(*model.CommandResponse)
|
||||||
|
require.True(t, strings.HasSuffix(rs7.GotoLocation, "/"+team.Name+"/channels/"+channel4.Name), "failed to join channel")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinCommands(t *testing.T) {
|
func TestJoinCommands(t *testing.T) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (*JoinProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (*JoinProvider) DoCommand(a *app.App, args *model.CommandArgs, message string) *model.CommandResponse {
|
func (*JoinProvider) DoCommand(a *app.App, args *model.CommandArgs, message string) *model.CommandResponse {
|
||||||
channelName := message
|
channelName := strings.ToLower(message)
|
||||||
|
|
||||||
if strings.HasPrefix(message, "~") {
|
if strings.HasPrefix(message, "~") {
|
||||||
channelName = message[1:]
|
channelName = message[1:]
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user