[release-10.11] Restrict group_constrained to channels that support group sync (#36916)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
56098dd6f0
Коммит
beaa59db54
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user