[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
Этот коммит содержится в:
Ben Cooke
2025-04-01 12:20:00 -04:00
коммит произвёл GitHub
родитель a47269cfe2
Коммит 2454de5b4a
10 изменённых файлов: 614 добавлений и 91 удалений

Просмотреть файл

@@ -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