diff options
author | Chris <ccbrown112@gmail.com> | 2018-02-12 18:36:39 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 18:36:39 -0600 |
commit | fbef16f8630f74248157c2cd9e546ece355c869a (patch) | |
tree | 95feb1a0b94f43fd38533adc508df2daf823ea86 /app/channel.go | |
parent | 56f49cf4860cfca51e852ec3e7d9df772d2b2060 (diff) | |
parent | 32c1f7be239ddb19d6c59b114d9ae1a543f8ba9c (diff) | |
download | chat-fbef16f8630f74248157c2cd9e546ece355c869a.tar.gz chat-fbef16f8630f74248157c2cd9e546ece355c869a.tar.bz2 chat-fbef16f8630f74248157c2cd9e546ece355c869a.zip |
Merge branch 'release-4.7' into rm-willnorris-proxy-support
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/app/channel.go b/app/channel.go index 8ac1f421c..e4bf48654 100644 --- a/app/channel.go +++ b/app/channel.go @@ -1359,7 +1359,7 @@ func (a *App) PermanentDeleteChannel(channel *model.Channel) *model.AppError { // This function is intended for use from the CLI. It is not robust against people joining the channel while the move // is in progress, and therefore should not be used from the API without first fixing this potential race condition. -func (a *App) MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError { +func (a *App) MoveChannel(team *model.Team, channel *model.Channel) *model.AppError { // Check that all channel members are in the destination team. if channelMembers, err := a.GetChannelMembersPage(channel.Id, 0, 10000000); err != nil { return err @@ -1378,37 +1378,11 @@ func (a *App) MoveChannel(team *model.Team, channel *model.Channel, user *model. } } - // keep instance of the previous team - var previousTeam *model.Team - if result := <-a.Srv.Store.Team().Get(channel.TeamId); result.Err != nil { - return result.Err - } else { - previousTeam = result.Data.(*model.Team) - } + // Change the Team ID of the channel. channel.TeamId = team.Id if result := <-a.Srv.Store.Channel().Update(channel); result.Err != nil { return result.Err } - a.postChannelMoveMessage(user, channel, previousTeam) - - return nil -} - -func (a *App) postChannelMoveMessage(user *model.User, channel *model.Channel, previousTeam *model.Team) *model.AppError { - - post := &model.Post{ - ChannelId: channel.Id, - Message: fmt.Sprintf(utils.T("api.team.move_channel.success"), previousTeam.Name), - Type: model.POST_MOVE_CHANNEL, - UserId: user.Id, - Props: model.StringInterface{ - "username": user.Username, - }, - } - - if _, err := a.CreatePost(post, channel, false); err != nil { - return model.NewAppError("postChannelMoveMessage", "api.team.move_channel.post.error", nil, err.Error(), http.StatusInternalServerError) - } return nil } |