mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-31105 /Join <channel name> is case sensitive (#16903)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
_ "github.com/mattermost/mattermost-server/v5/app/slashcommands"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"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")
|
||||
|
||||
// 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) {
|
||||
|
||||
@@ -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 {
|
||||
channelName := message
|
||||
channelName := strings.ToLower(message)
|
||||
|
||||
if strings.HasPrefix(message, "~") {
|
||||
channelName = message[1:]
|
||||
|
||||
Reference in New Issue
Block a user