[MM-63504] When changing a channel to group synced, it doesn't always clear members (#30526)
* fix issue with channel and team membership after group constraints are enabled
Этот коммит содержится в:
@@ -391,6 +391,15 @@ func patchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// If the channel is now group constrained but wasn't previously, delete members that aren't part of the channel's groups
|
||||
if patch.GroupConstrained != nil && *patch.GroupConstrained && (originalOldChannel.GroupConstrained == nil || !*originalOldChannel.GroupConstrained) {
|
||||
c.App.Srv().Go(func() {
|
||||
if err := c.App.DeleteGroupConstrainedChannelMemberships(c.AppContext, &rchannel.Id); err != nil {
|
||||
c.Logger.Warn("Error deleting group-constrained channel memberships", mlog.Err(err))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
appErr = c.App.FillInChannelProps(c.AppContext, rchannel)
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
|
||||
Ссылка в новой задаче
Block a user