diff options
author | Druhin Bala <theblueskies@users.noreply.github.com> | 2018-07-18 05:49:48 -0500 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-07-18 11:49:48 +0100 |
commit | 301e7eb1c424be9c3fb00401fdc2ea387bddee05 (patch) | |
tree | 7add86db67f23fc1749709af770d97b00afe2c5e /app/channel.go | |
parent | b367b1ff4064557deacae0f7ecf77fae4624b8c6 (diff) | |
download | chat-301e7eb1c424be9c3fb00401fdc2ea387bddee05.tar.gz chat-301e7eb1c424be9c3fb00401fdc2ea387bddee05.tar.bz2 chat-301e7eb1c424be9c3fb00401fdc2ea387bddee05.zip |
MM-10699 Add channel renaming to CLI (#9094)
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/channel.go b/app/channel.go index f9e77d737..ce183e6a9 100644 --- a/app/channel.go +++ b/app/channel.go @@ -159,6 +159,21 @@ func (a *App) CreateChannelWithUser(channel *model.Channel, userId string) (*mod return rchannel, nil } +// RenameChannel is used to rename the channel Name and the DisplayName fields +func (a *App) RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError) { + channel.Name = newChannelName + if newDisplayName != "" { + channel.DisplayName = newDisplayName + } + + newChannel, err := a.UpdateChannel(channel) + if err != nil { + return nil, err + } + + return newChannel, nil +} + func (a *App) CreateChannel(channel *model.Channel, addMember bool) (*model.Channel, *model.AppError) { if result := <-a.Srv.Store.Channel().Save(channel, *a.Config().TeamSettings.MaxChannelsPerTeam); result.Err != nil { return nil, result.Err |