diff options
author | Derrick Anderson <derrick@andersonwebstudio.com> | 2018-02-12 16:13:01 -0500 |
---|---|---|
committer | Derrick Anderson <derrick@andersonwebstudio.com> | 2018-02-12 16:13:01 -0500 |
commit | 32c1f7be239ddb19d6c59b114d9ae1a543f8ba9c (patch) | |
tree | 5e1653318a6a14bcad80025793adab0f700deed9 /app/channel.go | |
parent | 62efb1df754bfe6b10a3c17ca6f89fd33b991f56 (diff) | |
parent | c209e4457457edc042f063390c9a222a694f3a6d (diff) | |
download | chat-32c1f7be239ddb19d6c59b114d9ae1a543f8ba9c.tar.gz chat-32c1f7be239ddb19d6c59b114d9ae1a543f8ba9c.tar.bz2 chat-32c1f7be239ddb19d6c59b114d9ae1a543f8ba9c.zip |
Merge branch 'release-4.7-revertmaster' into release-4.7
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 } |