[MM-23727] Make channel validation consistent on the server (#14230)
* MM-23727 Ensure user ids not allowed in channel name: MM-23727 Move channel name validation to model level * MM-23727 Update wording
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
036f9384b4
Коммит
7bc630a600
@@ -234,6 +234,11 @@ func (o *Channel) IsValid() *AppError {
|
||||
return NewAppError("Channel.IsValid", "model.channel.is_valid.creator_id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
userIds := strings.Split(o.Name, "__")
|
||||
if o.Type != CHANNEL_DIRECT && len(userIds) == 2 && IsValidId(userIds[0]) && IsValidId(userIds[1]) {
|
||||
return NewAppError("Channel.IsValid", "model.channel.is_valid.name.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user