From 9097289c2ce2b719a5aa0f9d567594f2b6a7e30b Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Fri, 18 Aug 2017 17:04:05 +0800 Subject: [PLT-3377] Open up a shortcuts dialog instead of printing help text (#7064) * open up a shortcuts dialog instead of printing help text * Updating UI for keyboard shortcuts modal * update PR per PLT-7284 * fix typo error * fix mixed up shortcut keys * move to client side * fix shortcuts list, remove unused function and revert server side code for autocompletion * remove quick team switcher --- app/command_shortcuts.go | 63 +++--------------------------------------------- 1 file changed, 4 insertions(+), 59 deletions(-) (limited to 'app') diff --git a/app/command_shortcuts.go b/app/command_shortcuts.go index e10ae8a87..f6f365b04 100644 --- a/app/command_shortcuts.go +++ b/app/command_shortcuts.go @@ -4,9 +4,6 @@ package app import ( - "bytes" - "strings" - "github.com/mattermost/platform/model" goi18n "github.com/nicksnyder/go-i18n/i18n" ) @@ -37,61 +34,9 @@ func (me *ShortcutsProvider) GetCommand(T goi18n.TranslateFunc) *model.Command { } func (me *ShortcutsProvider) DoCommand(args *model.CommandArgs, message string) *model.CommandResponse { - shortcutIds := [...]string{ - "api.command_shortcuts.header", - // Nav shortcuts - "api.command_shortcuts.nav.header", - "api.command_shortcuts.nav.prev", - "api.command_shortcuts.nav.next", - "api.command_shortcuts.nav.unread_prev", - "api.command_shortcuts.nav.unread_next", - "api.command_shortcuts.nav.switcher", - "api.command_shortcuts.nav.direct_messages_menu", - "api.command_shortcuts.nav.settings", - "api.command_shortcuts.nav.recent_mentions", - // Files shortcuts - "api.command_shortcuts.files.header", - "api.command_shortcuts.files.upload", - // Msg shortcuts - "api.command_shortcuts.msgs.header", - "api.command_shortcuts.msgs.mark_as_read", - "api.command_shortcuts.msgs.reprint_prev", - "api.command_shortcuts.msgs.reprint_next", - "api.command_shortcuts.msgs.edit", - "api.command_shortcuts.msgs.reply", - "api.command_shortcuts.msgs.comp_username", - "api.command_shortcuts.msgs.comp_channel", - "api.command_shortcuts.msgs.comp_emoji", - // Browser shortcuts - "api.command_shortcuts.browser.header", - "api.command_shortcuts.browser.channel_prev", - "api.command_shortcuts.browser.channel_next", - "api.command_shortcuts.browser.font_increase", - "api.command_shortcuts.browser.font_decrease", - "api.command_shortcuts.browser.highlight_prev", - "api.command_shortcuts.browser.highlight_next", - "api.command_shortcuts.browser.newline", - } - - var osDependentWords map[string]interface{} - if strings.Contains(message, "mac") { - osDependentWords = map[string]interface{}{ - "CmdOrCtrl": args.T("api.command_shortcuts.cmd"), - "ChannelPrevCmd": args.T("api.command_shortcuts.browser.channel_prev.cmd_mac"), - "ChannelNextCmd": args.T("api.command_shortcuts.browser.channel_next.cmd_mac"), - } - } else { - osDependentWords = map[string]interface{}{ - "CmdOrCtrl": args.T("api.command_shortcuts.ctrl"), - "ChannelPrevCmd": args.T("api.command_shortcuts.browser.channel_prev.cmd"), - "ChannelNextCmd": args.T("api.command_shortcuts.browser.channel_next.cmd"), - } + // This command is handled client-side and shouldn't hit the server. + return &model.CommandResponse{ + Text: args.T("api.command_shortcuts.unsupported.app_error"), + ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, } - - var buffer bytes.Buffer - for _, element := range shortcutIds { - buffer.WriteString(args.T(element, osDependentWords)) - } - - return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: buffer.String()} } -- cgit v1.2.3-1-g7c22