diff options
author | Corey Hulen <corey@hulen.com> | 2016-01-25 09:07:35 -0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-01-25 09:07:35 -0500 |
commit | 93a4e85c2d183a48f84a269c38ad4b91e9c31c14 (patch) | |
tree | 9f7cf34b9c70e76524642cf20a3b6ad3c6f3c753 /model/post.go | |
parent | 2a32bf20045a563c3656d89c9e70ab6d3c4505f0 (diff) | |
parent | f33cff21cf41ed060783e1eaad6c1c4838216ed2 (diff) | |
download | chat-93a4e85c2d183a48f84a269c38ad4b91e9c31c14.tar.gz chat-93a4e85c2d183a48f84a269c38ad4b91e9c31c14.tar.bz2 chat-93a4e85c2d183a48f84a269c38ad4b91e9c31c14.zip |
Merge pull request #1974 from ZBoxApp/PLT-7-models
PLT-7: Refactoring models to use translations (chunk 6)
Diffstat (limited to 'model/post.go')
-rw-r--r-- | model/post.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/model/post.go b/model/post.go index 5c86ce70d..f9f5a4d1c 100644 --- a/model/post.go +++ b/model/post.go @@ -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 |