summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-10-16 23:11:32 +0200
committerWim <wim@42.be>2021-10-16 23:23:24 +0200
commit20f6c05ec50739d31f4dbe9fde0d223f2c43f6e8 (patch)
tree230edca06449a8d1755f08aabf45a03e07e6f17c /vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go
parent57fce93af7f64f025cec6f3ed6088163086bc9fe (diff)
downloadmatterbridge-msglm-20f6c05ec50739d31f4dbe9fde0d223f2c43f6e8.tar.gz
matterbridge-msglm-20f6c05ec50739d31f4dbe9fde0d223f2c43f6e8.tar.bz2
matterbridge-msglm-20f6c05ec50739d31f4dbe9fde0d223f2c43f6e8.zip
Update vendor
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go b/vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go
new file mode 100644
index 00000000..0f9e61d3
--- /dev/null
+++ b/vendor/github.com/mattermost/mattermost-server/v6/model/post_metadata.go
@@ -0,0 +1,64 @@
+// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
+// See LICENSE.txt for license information.
+
+package model
+
+type PostMetadata struct {
+ // Embeds holds information required to render content embedded in the post. This includes the OpenGraph metadata
+ // for links in the post.
+ Embeds []*PostEmbed `json:"embeds,omitempty"`
+
+ // Emojis holds all custom emojis used in the post or used in reaction to the post.
+ Emojis []*Emoji `json:"emojis,omitempty"`
+
+ // Files holds information about the file attachments on the post.
+ Files []*FileInfo `json:"files,omitempty"`
+
+ // Images holds the dimensions of all external images in the post as a map of the image URL to its diemsnions.
+ // This includes image embeds (when the message contains a plaintext link to an image), Markdown images, images
+ // contained in the OpenGraph metadata, and images contained in message attachments. It does not contain
+ // the dimensions of any file attachments as those are stored in FileInfos.
+ Images map[string]*PostImage `json:"images,omitempty"`
+
+ // Reactions holds reactions made to the post.
+ Reactions []*Reaction `json:"reactions,omitempty"`
+}
+
+type PostImage struct {
+ Width int `json:"width"`
+ Height int `json:"height"`
+
+ // Format is the name of the image format as used by image/go such as "png", "gif", or "jpeg".
+ Format string `json:"format"`
+
+ // FrameCount stores the number of frames in this image, if it is an animated gif. It will be 0 for other formats.
+ FrameCount int `json:"frame_count"`
+}
+
+// Copy does a deep copy
+func (p *PostMetadata) Copy() *PostMetadata {
+ embedsCopy := make([]*PostEmbed, len(p.Embeds))
+ copy(embedsCopy, p.Embeds)
+
+ emojisCopy := make([]*Emoji, len(p.Emojis))
+ copy(emojisCopy, p.Emojis)
+
+ filesCopy := make([]*FileInfo, len(p.Files))
+ copy(filesCopy, p.Files)
+
+ imagesCopy := map[string]*PostImage{}
+ for k, v := range p.Images {
+ imagesCopy[k] = v
+ }
+
+ reactionsCopy := make([]*Reaction, len(p.Reactions))
+ copy(reactionsCopy, p.Reactions)
+
+ return &PostMetadata{
+ Embeds: embedsCopy,
+ Emojis: emojisCopy,
+ Files: filesCopy,
+ Images: imagesCopy,
+ Reactions: reactionsCopy,
+ }
+}