PLT-7: Refactoring models to use translations (chunk 6)
- Add spanish translations
Этот коммит содержится в:
@@ -62,60 +62,60 @@ func (o *Post) Etag() string {
|
||||
func (o *Post) IsValid() *AppError {
|
||||
|
||||
if len(o.Id) != 26 {
|
||||
return NewAppError("Post.IsValid", "Invalid Id", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.id.app_error", nil, "")
|
||||
}
|
||||
|
||||
if o.CreateAt == 0 {
|
||||
return NewAppError("Post.IsValid", "Create at must be a valid time", "id="+o.Id)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.create_at.app_error", nil, "id="+o.Id)
|
||||
}
|
||||
|
||||
if o.UpdateAt == 0 {
|
||||
return NewAppError("Post.IsValid", "Update at must be a valid time", "id="+o.Id)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.update_at.app_error", nil, "id="+o.Id)
|
||||
}
|
||||
|
||||
if len(o.UserId) != 26 {
|
||||
return NewAppError("Post.IsValid", "Invalid user id", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.user_id.app_error", nil, "")
|
||||
}
|
||||
|
||||
if len(o.ChannelId) != 26 {
|
||||
return NewAppError("Post.IsValid", "Invalid channel id", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.channel_id.app_error", nil, "")
|
||||
}
|
||||
|
||||
if !(len(o.RootId) == 26 || len(o.RootId) == 0) {
|
||||
return NewAppError("Post.IsValid", "Invalid root id", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.root_id.app_error", nil, "")
|
||||
}
|
||||
|
||||
if !(len(o.ParentId) == 26 || len(o.ParentId) == 0) {
|
||||
return NewAppError("Post.IsValid", "Invalid parent id", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.parent_id.app_error", nil, "")
|
||||
}
|
||||
|
||||
if len(o.ParentId) == 26 && len(o.RootId) == 0 {
|
||||
return NewAppError("Post.IsValid", "Invalid root id must be set if parent id set", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.root_parent.app_error", nil, "")
|
||||
}
|
||||
|
||||
if !(len(o.OriginalId) == 26 || len(o.OriginalId) == 0) {
|
||||
return NewAppError("Post.IsValid", "Invalid original id", "")
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.original_id.app_error", nil, "")
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(o.Message) > 4000 {
|
||||
return NewAppError("Post.IsValid", "Invalid message", "id="+o.Id)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.msg.app_error", nil, "id="+o.Id)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(o.Hashtags) > 1000 {
|
||||
return NewAppError("Post.IsValid", "Invalid hashtags", "id="+o.Id)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.hashtags.app_error", nil, "id="+o.Id)
|
||||
}
|
||||
|
||||
// should be removed once more message types are supported
|
||||
if !(o.Type == POST_DEFAULT || o.Type == POST_JOIN_LEAVE || o.Type == POST_SLACK_ATTACHMENT || o.Type == POST_HEADER_CHANGE) {
|
||||
return NewAppError("Post.IsValid", "Invalid type", "id="+o.Type)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.type.app_error", nil, "id="+o.Type)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(ArrayToJson(o.Filenames)) > 4000 {
|
||||
return NewAppError("Post.IsValid", "Invalid filenames", "id="+o.Id)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > 8000 {
|
||||
return NewAppError("Post.IsValid", "Invalid props", "id="+o.Id)
|
||||
return NewLocAppError("Post.IsValid", "model.post.is_valid.props.app_error", nil, "id="+o.Id)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Ссылка в новой задаче
Block a user