summaryrefslogtreecommitdiffstats
path: root/model/post.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/post.go')
-rw-r--r--model/post.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/model/post.go b/model/post.go
index 33caeb9ea..da14b650f 100644
--- a/model/post.go
+++ b/model/post.go
@@ -35,7 +35,8 @@ type Post struct {
Type string `json:"type"`
Props StringInterface `json:"props"`
Hashtags string `json:"hashtags"`
- Filenames StringArray `json:"filenames"`
+ Filenames StringArray `json:"filenames,omitempty"` // Deprecated, do not use this field any more
+ FileIds StringArray `json:"file_ids,omitempty"`
PendingPostId string `json:"pending_post_id" db:"-"`
}
@@ -118,6 +119,10 @@ func (o *Post) IsValid() *AppError {
return NewLocAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id)
}
+ if utf8.RuneCountInString(ArrayToJson(o.FileIds)) > 150 {
+ return NewLocAppError("Post.IsValid", "model.post.is_valid.file_ids.app_error", nil, "id="+o.Id)
+ }
+
if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > 8000 {
return NewLocAppError("Post.IsValid", "model.post.is_valid.props.app_error", nil, "id="+o.Id)
}
@@ -145,15 +150,16 @@ func (o *Post) PreSave() {
if o.Filenames == nil {
o.Filenames = []string{}
}
+
+ if o.FileIds == nil {
+ o.FileIds = []string{}
+ }
}
func (o *Post) MakeNonNil() {
if o.Props == nil {
o.Props = make(map[string]interface{})
}
- if o.Filenames == nil {
- o.Filenames = []string{}
- }
}
func (o *Post) AddProp(key string, value interface{}) {