summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/post.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/post.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/post.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/vendor/github.com/mattermost/platform/model/post.go b/vendor/github.com/mattermost/platform/model/post.go
index 33caeb9e..da14b650 100644
--- a/vendor/github.com/mattermost/platform/model/post.go
+++ b/vendor/github.com/mattermost/platform/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{}) {