summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/command_shortcuts.go9
-rw-r--r--api/command_shortcuts_test.go7
2 files changed, 14 insertions, 2 deletions
diff --git a/api/command_shortcuts.go b/api/command_shortcuts.go
index 77f9f4441..0cdf821c8 100644
--- a/api/command_shortcuts.go
+++ b/api/command_shortcuts.go
@@ -5,6 +5,7 @@ package api
import (
"github.com/mattermost/platform/model"
+ "strings"
)
type ShortcutsProvider struct {
@@ -33,5 +34,11 @@ func (me *ShortcutsProvider) GetCommand(c *Context) *model.Command {
}
func (me *ShortcutsProvider) DoCommand(c *Context, channelId string, message string) *model.CommandResponse {
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command_shortcuts.list")}
+ stringId := "api.command_shortcuts.list"
+
+ if strings.Contains(message, "mac") {
+ stringId = "api.command_shortcuts.list_mac"
+ }
+
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T(stringId)}
}
diff --git a/api/command_shortcuts_test.go b/api/command_shortcuts_test.go
index a00bd3440..01c56b465 100644
--- a/api/command_shortcuts_test.go
+++ b/api/command_shortcuts_test.go
@@ -15,7 +15,12 @@ func TestShortcutsCommand(t *testing.T) {
channel := th.BasicChannel
rs := Client.Must(Client.Command(channel.Id, "/shortcuts ", false)).Data.(*model.CommandResponse)
- if !strings.Contains(rs.Text, "ALT") {
+ if !strings.Contains(rs.Text, "CTRL") {
t.Fatal("failed to display shortcuts")
}
+
+ rs = Client.Must(Client.Command(channel.Id, "/shortcuts mac", false)).Data.(*model.CommandResponse)
+ if !strings.Contains(rs.Text, "CMD") {
+ t.Fatal("failed to display Mac shortcuts")
+ }
}