summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/post.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-08-16 23:37:37 +0200
committerWim <wim@42.be>2017-08-16 23:37:37 +0200
commitb963f83c6a09da1eaf02eb9f269c6f5881a0c711 (patch)
tree5ec37162046349d23c627e9ee26fb70c1a6c4f08 /vendor/github.com/mattermost/platform/model/post.go
parentf6297ebbb09611165a50a6cd15abf6499268cf86 (diff)
downloadmatterbridge-msglm-b963f83c6a09da1eaf02eb9f269c6f5881a0c711.tar.gz
matterbridge-msglm-b963f83c6a09da1eaf02eb9f269c6f5881a0c711.tar.bz2
matterbridge-msglm-b963f83c6a09da1eaf02eb9f269c6f5881a0c711.zip
Update mattermost vendor (3.7 => 4.1)
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/post.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/post.go59
1 files changed, 58 insertions, 1 deletions
diff --git a/vendor/github.com/mattermost/platform/model/post.go b/vendor/github.com/mattermost/platform/model/post.go
index a7729e0c..55e6f591 100644
--- a/vendor/github.com/mattermost/platform/model/post.go
+++ b/vendor/github.com/mattermost/platform/model/post.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
@@ -38,6 +38,7 @@ type Post struct {
UpdateAt int64 `json:"update_at"`
EditAt int64 `json:"edit_at"`
DeleteAt int64 `json:"delete_at"`
+ IsPinned bool `json:"is_pinned"`
UserId string `json:"user_id"`
ChannelId string `json:"channel_id"`
RootId string `json:"root_id"`
@@ -53,6 +54,20 @@ type Post struct {
HasReactions bool `json:"has_reactions,omitempty"`
}
+type PostPatch struct {
+ IsPinned *bool `json:"is_pinned"`
+ Message *string `json:"message"`
+ Props *StringInterface `json:"props"`
+ FileIds *StringArray `json:"file_ids"`
+ HasReactions *bool `json:"has_reactions"`
+}
+
+type PostForIndexing struct {
+ Post
+ TeamId string `json:"team_id"`
+ ParentCreateAt *int64 `json:"parent_create_at"`
+}
+
func (o *Post) ToJson() string {
b, err := json.Marshal(o)
if err != nil {
@@ -189,3 +204,45 @@ func (o *Post) AddProp(key string, value interface{}) {
func (o *Post) IsSystemMessage() bool {
return len(o.Type) >= len(POST_SYSTEM_MESSAGE_PREFIX) && o.Type[:len(POST_SYSTEM_MESSAGE_PREFIX)] == POST_SYSTEM_MESSAGE_PREFIX
}
+
+func (p *Post) Patch(patch *PostPatch) {
+ if patch.IsPinned != nil {
+ p.IsPinned = *patch.IsPinned
+ }
+
+ if patch.Message != nil {
+ p.Message = *patch.Message
+ }
+
+ if patch.Props != nil {
+ p.Props = *patch.Props
+ }
+
+ if patch.FileIds != nil {
+ p.FileIds = *patch.FileIds
+ }
+
+ if patch.HasReactions != nil {
+ p.HasReactions = *patch.HasReactions
+ }
+}
+
+func (o *PostPatch) ToJson() string {
+ b, err := json.Marshal(o)
+ if err != nil {
+ return ""
+ }
+
+ return string(b)
+}
+
+func PostPatchFromJson(data io.Reader) *PostPatch {
+ decoder := json.NewDecoder(data)
+ var post PostPatch
+ err := decoder.Decode(&post)
+ if err != nil {
+ return nil
+ }
+
+ return &post
+}