diff options
author | Wim <wim@42.be> | 2017-01-16 23:59:50 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-01-17 00:00:26 +0100 |
commit | 93114b76828357644afb22f7359c0ba185719478 (patch) | |
tree | aaaf5f855256b3750ee6e5b0c082a5bca0f0dd20 /vendor/github.com/mattermost/platform/model/post.go | |
parent | 9987ac3f13671bf6c4e1530544afa865035b0efd (diff) | |
download | matterbridge-msglm-93114b76828357644afb22f7359c0ba185719478.tar.gz matterbridge-msglm-93114b76828357644afb22f7359c0ba185719478.tar.bz2 matterbridge-msglm-93114b76828357644afb22f7359c0ba185719478.zip |
Sync with mattermost 3.6.0
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/post.go')
-rw-r--r-- | vendor/github.com/mattermost/platform/model/post.go | 21 |
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) } |