[release-10.11] Restrict group_constrained to channels that support group sync (#36916)

Automatic Merge
Этот коммит содержится в:
Maria A Nunez
2026-06-05 03:29:59 -04:00
коммит произвёл GitHub
родитель 56098dd6f0
Коммит beaa59db54
6 изменённых файлов: 95 добавлений и 0 удалений

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

@@ -329,6 +329,10 @@ func (o *Channel) IsValid() *AppError {
}
}
if o.IsGroupConstrained() && !o.SupportsGroupSync() {
return NewAppError("Channel.IsValid", "model.channel.is_valid.group_constrained.app_error", nil, "id="+o.Id, http.StatusBadRequest)
}
return nil
}
@@ -356,6 +360,11 @@ func (o *Channel) IsGroupOrDirect() bool {
return o.Type == ChannelTypeDirect || o.Type == ChannelTypeGroup
}
// SupportsGroupSync reports whether group_constrained is meaningful for the channel type.
func (o *Channel) SupportsGroupSync() bool {
return o.Type == ChannelTypeOpen || o.Type == ChannelTypePrivate
}
func (o *Channel) IsOpen() bool {
return o.Type == ChannelTypeOpen
}