From 2da388d297385a0068042cac7cbd362300e7e965 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Tue, 20 Dec 2016 09:28:00 -0500 Subject: Fixes for the /echo command (#4843) --- api/command_echo.go | 4 ++++ api/command_echo_test.go | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'api') diff --git a/api/command_echo.go b/api/command_echo.go index 4f6f6e33a..c219945c7 100644 --- a/api/command_echo.go +++ b/api/command_echo.go @@ -40,6 +40,10 @@ func (me *EchoProvider) GetCommand(c *Context) *model.Command { } func (me *EchoProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse { + if len(message) == 0 { + return &model.CommandResponse{Text: c.T("api.command_echo.message.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} + } + maxThreads := 100 delay := 0 diff --git a/api/command_echo_test.go b/api/command_echo_test.go index 71a378242..02583d2aa 100644 --- a/api/command_echo_test.go +++ b/api/command_echo_test.go @@ -17,8 +17,11 @@ func TestEchoCommand(t *testing.T) { echoTestString := "/echo test" - r1 := Client.Must(Client.Command(channel1.Id, echoTestString)).Data.(*model.CommandResponse) - if r1 == nil { + if r1 := Client.Must(Client.Command(channel1.Id, echoTestString)).Data.(*model.CommandResponse); r1 == nil { + t.Fatal("Echo command failed to execute") + } + + if r1 := Client.Must(Client.Command(channel1.Id, "/echo ")).Data.(*model.CommandResponse); r1 == nil { t.Fatal("Echo command failed to execute") } -- cgit v1.2.3-1-g7c22