From 816bfbeb91b9cd64a8a85dc37cc0e82554409c14 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 21 Jul 2017 21:04:41 +0200 Subject: [PLT-6708] /purpose [text] slash command: Edit the channel purpose (#6569) * /purpose [text] slash command: Edit the channel purpose * update command on server side to check for direct or group channels * update stings and block the dialog when is DM or GM * update per review * remove duplicate websocker event and apply the same for /header command * update per review * update --- app/command_channel_header.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'app/command_channel_header.go') diff --git a/app/command_channel_header.go b/app/command_channel_header.go index b5a70ef89..e552f9282 100644 --- a/app/command_channel_header.go +++ b/app/command_channel_header.go @@ -4,7 +4,6 @@ package app import ( - l4g "github.com/alecthomas/log4go" "github.com/mattermost/platform/model" goi18n "github.com/nicksnyder/go-i18n/i18n" @@ -53,21 +52,15 @@ func (me *HeaderProvider) DoCommand(args *model.CommandArgs, message string) *mo return &model.CommandResponse{Text: args.T("api.command_channel_header.message.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } - oldChannelHeader := channel.Header - channel.Header = message + patch := &model.ChannelPatch{ + Header: new(string), + } + *patch.Header = message - updateChannel, err := UpdateChannel(channel) + _, err = PatchChannel(channel, patch, args.UserId) if err != nil { return &model.CommandResponse{Text: args.T("api.command_channel_header.update_channel.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL} } - messageWs := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_UPDATED, "", channel.Id, "", nil) - messageWs.Add("channel", channel.ToJson()) - Publish(messageWs) - - if err := PostUpdateChannelHeaderMessage(args.Session.UserId, channel.Id, args.TeamId, oldChannelHeader, updateChannel.Header); err != nil { - l4g.Error(err.Error()) - } - return &model.CommandResponse{} } -- cgit v1.2.3-1-g7c22