diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-05-17 12:40:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 12:40:40 -0700 |
commit | 11cbb597471127c1b29e78e6cad0a1a4d93ea24c (patch) | |
tree | 0eceb950872c7234348f0b41d4492073908840d0 /cmd/commands/channelargs.go | |
parent | 1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff) | |
download | chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.gz chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.tar.bz2 chat-11cbb597471127c1b29e78e6cad0a1a4d93ea24c.zip |
Renaming platform binary to mattermost. (#8801)
Diffstat (limited to 'cmd/commands/channelargs.go')
-rw-r--r-- | cmd/commands/channelargs.go | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/cmd/commands/channelargs.go b/cmd/commands/channelargs.go deleted file mode 100644 index 680fed34b..000000000 --- a/cmd/commands/channelargs.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package commands - -import ( - "fmt" - "strings" - - "github.com/mattermost/mattermost-server/app" - "github.com/mattermost/mattermost-server/model" -) - -const CHANNEL_ARG_SEPARATOR = ":" - -func getChannelsFromChannelArgs(a *app.App, channelArgs []string) []*model.Channel { - channels := make([]*model.Channel, 0, len(channelArgs)) - for _, channelArg := range channelArgs { - channel := getChannelFromChannelArg(a, channelArg) - channels = append(channels, channel) - } - return channels -} - -func parseChannelArg(channelArg string) (string, string) { - result := strings.SplitN(channelArg, CHANNEL_ARG_SEPARATOR, 2) - if len(result) == 1 { - return "", channelArg - } - return result[0], result[1] -} - -func getChannelFromChannelArg(a *app.App, channelArg string) *model.Channel { - teamArg, channelPart := parseChannelArg(channelArg) - if teamArg == "" && channelPart == "" { - return nil - } - - var channel *model.Channel - if teamArg != "" { - team := getTeamFromTeamArg(a, teamArg) - if team == nil { - return nil - } - - if result := <-a.Srv.Store.Channel().GetByNameIncludeDeleted(team.Id, channelPart, true); result.Err == nil { - channel = result.Data.(*model.Channel) - } else { - fmt.Println(result.Err.Error()) - } - } - - if channel == nil { - if result := <-a.Srv.Store.Channel().Get(channelPart, true); result.Err == nil { - channel = result.Data.(*model.Channel) - } - } - - return channel -} |