summaryrefslogtreecommitdiffstats
path: root/cmd/platform/channel.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/platform/channel.go')
-rw-r--r--cmd/platform/channel.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd/platform/channel.go b/cmd/platform/channel.go
index cf5ef61bc..2a10516af 100644
--- a/cmd/platform/channel.go
+++ b/cmd/platform/channel.go
@@ -6,6 +6,7 @@ import (
"errors"
"github.com/mattermost/platform/api"
+ "github.com/mattermost/platform/app"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
"github.com/spf13/cobra"
@@ -117,6 +118,8 @@ func createChannelCmdF(cmd *cobra.Command, args []string) error {
team := getTeamFromTeamArg(teamArg)
+ c := getMockContext()
+
channel := &model.Channel{
TeamId: team.Id,
Name: name,
@@ -124,10 +127,10 @@ func createChannelCmdF(cmd *cobra.Command, args []string) error {
Header: header,
Purpose: purpose,
Type: channelType,
+ CreatorId: c.Session.UserId,
}
- c := getMockContext()
- if _, err := api.CreateChannel(c, channel, false); err != nil {
+ if _, err := app.CreateChannel(channel, false); err != nil {
return err
}
@@ -197,7 +200,7 @@ func addUserToChannel(channel *model.Channel, user *model.User, userArg string)
CommandPrintErrorln("Can't find user '" + userArg + "'")
return
}
- if _, err := api.AddUserToChannel(user, channel); err != nil {
+ if _, err := app.AddUserToChannel(user, channel); err != nil {
CommandPrintErrorln("Unable to add '" + userArg + "' from " + channel.Name + ". Error: " + err.Error())
}
}
@@ -215,7 +218,7 @@ func deleteChannelsCmdF(cmd *cobra.Command, args []string) error {
CommandPrintErrorln("Unable to find channel '" + args[i] + "'")
continue
}
- if result := <-api.Srv.Store.Channel().Delete(channel.Id, model.GetMillis()); result.Err != nil {
+ if result := <-app.Srv.Store.Channel().Delete(channel.Id, model.GetMillis()); result.Err != nil {
CommandPrintErrorln("Unable to delete channel '" + channel.Name + "' error: " + result.Err.Error())
}
}
@@ -240,7 +243,7 @@ func listChannelsCmdF(cmd *cobra.Command, args []string) error {
CommandPrintErrorln("Unable to find team '" + args[i] + "'")
continue
}
- if result := <-api.Srv.Store.Channel().GetAll(team.Id); result.Err != nil {
+ if result := <-app.Srv.Store.Channel().GetAll(team.Id); result.Err != nil {
CommandPrintErrorln("Unable to list channels for '" + args[i] + "'")
} else {
channels := result.Data.([]*model.Channel)
@@ -275,7 +278,7 @@ func restoreChannelsCmdF(cmd *cobra.Command, args []string) error {
CommandPrintErrorln("Unable to find channel '" + args[i] + "'")
continue
}
- if result := <-api.Srv.Store.Channel().SetDeleteAt(channel.Id, 0, model.GetMillis()); result.Err != nil {
+ if result := <-app.Srv.Store.Channel().SetDeleteAt(channel.Id, 0, model.GetMillis()); result.Err != nil {
CommandPrintErrorln("Unable to restore channel '" + args[i] + "'")
}
}