From 5064f9cba2a63c166776279b2763151f8aed5310 Mon Sep 17 00:00:00 2001 From: Justyn Shull Date: Tue, 29 Sep 2015 11:48:13 -0500 Subject: Update the /join command to use the correct redirect URL, and update the test to match --- api/command.go | 2 +- api/command_test.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/command.go b/api/command.go index 0d2f7597b..427922344 100644 --- a/api/command.go +++ b/api/command.go @@ -195,7 +195,7 @@ func joinCommand(c *Context, command *model.Command) bool { return false } - command.GotoLocation = "/channels/" + v.Name + command.GotoLocation = c.GetTeamURL() + "/channels/" + v.Name command.Response = model.RESP_EXECUTED return true } diff --git a/api/command_test.go b/api/command_test.go index fe52dd41b..d70729448 100644 --- a/api/command_test.go +++ b/api/command_test.go @@ -4,6 +4,7 @@ package api import ( + "strings" "testing" "github.com/mattermost/platform/model" @@ -126,12 +127,12 @@ func TestJoinCommands(t *testing.T) { } rs5 := Client.Must(Client.Command("", "/join "+channel2.Name, false)).Data.(*model.Command) - if rs5.GotoLocation != "/channels/"+channel2.Name { + if !strings.HasSuffix(rs5.GotoLocation, "/"+team.Name+"/channels/"+channel2.Name) { t.Fatal("failed to join channel") } rs6 := Client.Must(Client.Command("", "/join "+channel3.Name, false)).Data.(*model.Command) - if rs6.GotoLocation == "/channels/"+channel3.Name { + if strings.HasSuffix(rs6.GotoLocation, "/"+team.Name+"/channels/"+channel3.Name) { t.Fatal("should not have joined direct message channel") } -- cgit v1.2.3-1-g7c22