From 3056b192fe0e9fe7d7814ecaa91c71c4bf1f7699 Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Wed, 7 Aug 2019 18:09:23 -0400 Subject: [PATCH] MM-17496: Skip adding user to default channel (rather than failing) when user has already left the parent team. (#11790) --- app/syncables.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/syncables.go b/app/syncables.go index 39512782c8..1b4e48a9ff 100644 --- a/app/syncables.go +++ b/app/syncables.go @@ -57,7 +57,14 @@ func (a *App) CreateDefaultMemberships(since int64) error { _, err = a.AddChannelMember(userChannel.UserID, channel, "", "") if err != nil { - return err + if err.Id == "api.channel.add_user.to.channel.failed.deleted.app_error" { + a.Log.Info("Not adding user to channel because they have already left the team", + mlog.String("user_id", userChannel.UserID), + mlog.String("channel_id", userChannel.ChannelID), + ) + } else { + return err + } } a.Log.Info("added channelmember",