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.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/vendor/github.com/mattermost/platform/model/post.go b/vendor/github.com/mattermost/platform/model/post.go
index da14b650..7097e031 100644
--- a/vendor/github.com/mattermost/platform/model/post.go
+++ b/vendor/github.com/mattermost/platform/model/post.go
@@ -17,8 +17,14 @@ const (
POST_JOIN_LEAVE = "system_join_leave"
POST_ADD_REMOVE = "system_add_remove"
POST_HEADER_CHANGE = "system_header_change"
+ POST_DISPLAYNAME_CHANGE = "system_displayname_change"
POST_CHANNEL_DELETED = "system_channel_deleted"
POST_EPHEMERAL = "system_ephemeral"
+ POST_FILEIDS_MAX_RUNES = 150
+ POST_FILENAMES_MAX_RUNES = 4000
+ POST_HASHTAGS_MAX_RUNES = 1000
+ POST_MESSAGE_MAX_RUNES = 4000
+ POST_PROPS_MAX_RUNES = 8000
)
type Post struct {
@@ -38,6 +44,7 @@ type Post struct {
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:"-"`
+ HasReactions bool `json:"has_reactions,omitempty"`
}
func (o *Post) ToJson() string {
@@ -102,28 +109,30 @@ func (o *Post) IsValid() *AppError {
return NewLocAppError("Post.IsValid", "model.post.is_valid.original_id.app_error", nil, "")
}
- if utf8.RuneCountInString(o.Message) > 4000 {
+ if utf8.RuneCountInString(o.Message) > POST_MESSAGE_MAX_RUNES {
return NewLocAppError("Post.IsValid", "model.post.is_valid.msg.app_error", nil, "id="+o.Id)
}
- if utf8.RuneCountInString(o.Hashtags) > 1000 {
+ if utf8.RuneCountInString(o.Hashtags) > POST_HASHTAGS_MAX_RUNES {
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_ADD_REMOVE || o.Type == POST_SLACK_ATTACHMENT || o.Type == POST_HEADER_CHANGE) {
+ if !(o.Type == POST_DEFAULT || o.Type == POST_JOIN_LEAVE || o.Type == POST_ADD_REMOVE ||
+ o.Type == POST_SLACK_ATTACHMENT || o.Type == POST_HEADER_CHANGE ||
+ o.Type == POST_DISPLAYNAME_CHANGE || o.Type == POST_CHANNEL_DELETED) {
return NewLocAppError("Post.IsValid", "model.post.is_valid.type.app_error", nil, "id="+o.Type)
}
- if utf8.RuneCountInString(ArrayToJson(o.Filenames)) > 4000 {
+ if utf8.RuneCountInString(ArrayToJson(o.Filenames)) > POST_FILENAMES_MAX_RUNES {
return NewLocAppError("Post.IsValid", "model.post.is_valid.filenames.app_error", nil, "id="+o.Id)
}
- if utf8.RuneCountInString(ArrayToJson(o.FileIds)) > 150 {
+ if utf8.RuneCountInString(ArrayToJson(o.FileIds)) > POST_FILEIDS_MAX_RUNES {
return NewLocAppError("Post.IsValid", "model.post.is_valid.file_ids.app_error", nil, "id="+o.Id)
}
- if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > 8000 {
+ if utf8.RuneCountInString(StringInterfaceToJson(o.Props)) > POST_PROPS_MAX_RUNES {
return NewLocAppError("Post.IsValid", "model.post.is_valid.props.app_error", nil, "id="+o.Id)
}