summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-12-20 09:28:00 -0500
committerChristopher Speller <crspeller@gmail.com>2016-12-20 09:28:00 -0500
commit2da388d297385a0068042cac7cbd362300e7e965 (patch)
tree613df74fdc3c75c3f5fbc186eac4d38c61f980b1
parent1f67c91fcec746aeeb34b9c39b7df328d5f6a4a0 (diff)
downloadchat-2da388d297385a0068042cac7cbd362300e7e965.tar.gz
chat-2da388d297385a0068042cac7cbd362300e7e965.tar.bz2
chat-2da388d297385a0068042cac7cbd362300e7e965.zip
Fixes for the /echo command (#4843)
-rw-r--r--api/command_echo.go4
-rw-r--r--api/command_echo_test.go7
-rw-r--r--i18n/en.json4
3 files changed, 13 insertions, 2 deletions
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")
}
diff --git a/i18n/en.json b/i18n/en.json
index fd43adbf0..1c1281263 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -492,6 +492,10 @@
"translation": "Unable to create /echo post, err=%v"
},
{
+ "id": "api.command_echo.message.app_error",
+ "translation": "A message must be provided with the /echo command."
+ },
+ {
"id": "api.command_echo.delay.app_error",
"translation": "Delays must be under 10000 seconds"
},