summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-10-08 16:39:03 +0100
committerGitHub <noreply@github.com>2018-10-08 16:39:03 +0100
commit9a4f3ce1e5b22a297eeb00b2aaff44f88304ae8c (patch)
tree8841d645463b21a175036399e78ecae647922e55 /app/channel.go
parent7b338c161bce8bdede54d85a5df5a0efe34eb874 (diff)
downloadchat-9a4f3ce1e5b22a297eeb00b2aaff44f88304ae8c.tar.gz
chat-9a4f3ce1e5b22a297eeb00b2aaff44f88304ae8c.tar.bz2
chat-9a4f3ce1e5b22a297eeb00b2aaff44f88304ae8c.zip
MM-12251: Add flag to MoveChannel to remove all deactivated users. (#9515)
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/channel.go b/app/channel.go
index 54b589175..93037cf05 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -1670,7 +1670,13 @@ 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, user *model.User, removeDeactivatedMembers bool) *model.AppError {
+ if removeDeactivatedMembers {
+ if result := <-a.Srv.Store.Channel().RemoveAllDeactivatedMembers(channel.Id); result.Err != nil {
+ return result.Err
+ }
+ }
+
// Check that all channel members are in the destination team.
channelMembers, err := a.GetChannelMembersPage(channel.Id, 0, 10000000)
if err != nil {