summaryrefslogtreecommitdiffstats
path: root/cmd/platform/channelargs.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-03-07 20:04:18 +0000
committerGitHub <noreply@github.com>2018-03-07 20:04:18 +0000
commitb2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5 (patch)
tree00d2bbb524e27727dc111994082f5293e6d12b11 /cmd/platform/channelargs.go
parent03b6d1f652407fa9c3ec7e740e120a1c3e920de0 (diff)
downloadchat-b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5.tar.gz
chat-b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5.tar.bz2
chat-b2dd00dd5b83fc7e8b311a55f5a2536e4f3d45a5.zip
Adding enterprise commands support (#8327)
Diffstat (limited to 'cmd/platform/channelargs.go')
-rw-r--r--cmd/platform/channelargs.go59
1 files changed, 0 insertions, 59 deletions
diff --git a/cmd/platform/channelargs.go b/cmd/platform/channelargs.go
deleted file mode 100644
index c12a9cc9a..000000000
--- a/cmd/platform/channelargs.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-package main
-
-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
-}