mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* MM-13664 Added LinkMetadata types * MM-13664 Use LinkMetadata when populating post metadata * Fix unused import * Fix index name on SQLite * Finish adding unit tests * Address feedback * Increase max length of URL column to 2048 characters
40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
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"`
|
|
}
|
|
|
|
func (o *PostImage) ToJson() string {
|
|
b, _ := json.Marshal(o)
|
|
return string(b)
|
|
}
|