github.com/coincircle/mattermost-server@v4.8.1-0.20180321182714-9d701c704416+incompatible/app/command_search.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package app
     5  
     6  import (
     7  	"github.com/mattermost/mattermost-server/model"
     8  	goi18n "github.com/nicksnyder/go-i18n/i18n"
     9  )
    10  
    11  type SearchProvider struct {
    12  }
    13  
    14  const (
    15  	CMD_SEARCH = "search"
    16  )
    17  
    18  func init() {
    19  	RegisterCommandProvider(&SearchProvider{})
    20  }
    21  
    22  func (search *SearchProvider) GetTrigger() string {
    23  	return CMD_SEARCH
    24  }
    25  
    26  func (search *SearchProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command {
    27  	return &model.Command{
    28  		Trigger:          CMD_SEARCH,
    29  		AutoComplete:     true,
    30  		AutoCompleteDesc: T("api.command_search.desc"),
    31  		AutoCompleteHint: T("api.command_search.hint"),
    32  		DisplayName:      T("api.command_search.name"),
    33  	}
    34  }
    35  
    36  func (search *SearchProvider) DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse {
    37  	// This command is handled client-side and shouldn't hit the server.
    38  	return &model.CommandResponse{
    39  		Text:         args.T("api.command_search.unsupported.app_error"),
    40  		ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,
    41  	}
    42  }