mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
* Add read receipt store for burn on read message types * update mocks * fix invalidation target * have consistent case on index creation * Add temporary posts table * add mock * add transaction support * reflect review comments * wip: Add reveal endpoint * user check error id instead * wip: Add ws events and cleanup for burn on read posts * add burn endpoint for explicitly burning messages * add translations * Added logic to associate files of BoR post with the post * Added test * fixes * disable pinning posts and review comments * MM-66594 - Burn on read UI integration (#34647) * MM-66244 - add BoR visual components to message editor * MM-66246 - BoR visual indicator for sender and receiver * MM-66607 - bor - add timer countdown and autodeletion * add the system console max time to live config * use the max expire at and create global scheduler to register bor messages * use seconds for BoR config values in BE * implement the read by text shown in the tooltip logic * unestack the posts from same receiver and BoR and fix styling * avoid opening reply RHS * remove unused dispatchers * persis the BoR label in the drafts * move expiration value to metadata * adjust unit tests to metadata insted of props * code clean up and some performance improvements; add period grace for deletion too * adjust migration serie number * hide bor messages when config is off * performance improvements on post component and code clean up * keep bor existing post functionality if config is disabled * Add read receipt store for burn on read message types * Add temporary posts table * add transaction support * reflect review comments * wip: Add reveal endpoint * user check error id instead * wip: Add ws events and cleanup for burn on read posts * avoid reacting to unrevealed bor messages * adjust migration number * Add read receipt store for burn on read message types * have consistent case on index creation * Add temporary posts table * add mock * add transaction support * reflect review comments * wip: Add reveal endpoint * user check error id instead * wip: Add ws events and cleanup for burn on read posts * add burn endpoint for explicitly burning messages * adjust post reveal and type with backend changes * use real config values, adjust icon usage and style * adjust the delete from from sender and receiver * improve self deleting logic by placing in badge, use burn endpoint * adjust websocket events handling for the read by sender label information * adjust styling for concealed and error state * update burn-on-read post event handling for improved recipient tracking and multi-device sync * replace burn_on_read with type in database migrations and model * remove burn_on_read metadata from PostMetadata and related structures * Added logic to associate files of BoR post with the post * Added test * adjust migration name and fix linter * Add read receipt store for burn on read message types * update mocks * have consistent case on index creation * Add temporary posts table * add mock * add transaction support * reflect review comments * wip: Add reveal endpoint * user check error id instead * wip: Add ws events and cleanup for burn on read posts * add burn endpoint for explicitly burning messages * Added logic to associate files of BoR post with the post * Added test * disable pinning posts and review comments * show attachment on bor reveal * remove unused translation * Enhance burn-on-read post handling and refine previous post ID retrieval logic * adjust the returning chunk to work with bor messages * read temp post from master db * read from master * show the copy link button to the sender * revert unnecessary check * restore correct json tag * remove unused error handling and clarify burn-on-read comment * improve type safety and use proper selectors * eliminate code duplication in deletion handler * optimize performance and add documentation * delete bor message for sender once all receivers reveal it * add burn on read to scheduled posts * add feature enable check * use master to avoid all read recipients race condition --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com> * squash migrations into single file * add configuration for the scheduler * don't run messagehasbeenposted hook * remove parallel tests on burn on read * add clean up for closing opened modals from previous tests * simplify delete menu item rendering * add cleanup step to close open modals after each test to prevent pollution * streamline delete button visibility logic for Burn on Read posts * improve reliability of closing post menu and modals by using body ESC key --------- Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com> Co-authored-by: Pablo Vélez <pablovv2012@gmail.com> Co-authored-by: Mattermost Build <build@mattermost.com>
111 lines
3.5 KiB
Go
111 lines
3.5 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"maps"
|
|
)
|
|
|
|
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 dimensions.
|
|
// 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"`
|
|
|
|
// Priority holds info about priority settings for the post.
|
|
Priority *PostPriority `json:"priority,omitempty"`
|
|
|
|
// Acknowledgements holds acknowledgements made by users to the post
|
|
Acknowledgements []*PostAcknowledgement `json:"acknowledgements,omitempty"`
|
|
|
|
ExpireAt int64 `json:"expire_at,omitempty"`
|
|
Recipients []string `json:"recipients,omitempty"`
|
|
}
|
|
|
|
func (p *PostMetadata) Auditable() map[string]any {
|
|
embeds := make([]map[string]any, 0, len(p.Embeds))
|
|
for _, pe := range p.Embeds {
|
|
embeds = append(embeds, pe.Auditable())
|
|
}
|
|
if len(embeds) == 0 {
|
|
embeds = nil
|
|
}
|
|
|
|
return map[string]any{
|
|
"embeds": embeds,
|
|
"emojis": p.Emojis,
|
|
"files": p.Files,
|
|
"images": p.Images,
|
|
"reactions": p.Reactions,
|
|
"priority": p.Priority,
|
|
"acknowledgements": p.Acknowledgements,
|
|
}
|
|
}
|
|
|
|
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{}
|
|
maps.Copy(imagesCopy, p.Images)
|
|
|
|
reactionsCopy := make([]*Reaction, len(p.Reactions))
|
|
copy(reactionsCopy, p.Reactions)
|
|
|
|
acknowledgementsCopy := make([]*PostAcknowledgement, len(p.Acknowledgements))
|
|
copy(acknowledgementsCopy, p.Acknowledgements)
|
|
|
|
var postPriorityCopy *PostPriority
|
|
if p.Priority != nil {
|
|
postPriorityCopy = &PostPriority{
|
|
Priority: p.Priority.Priority,
|
|
RequestedAck: p.Priority.RequestedAck,
|
|
PersistentNotifications: p.Priority.PersistentNotifications,
|
|
PostId: p.Priority.PostId,
|
|
ChannelId: p.Priority.ChannelId,
|
|
}
|
|
}
|
|
|
|
return &PostMetadata{
|
|
Embeds: embedsCopy,
|
|
Emojis: emojisCopy,
|
|
Files: filesCopy,
|
|
Images: imagesCopy,
|
|
Reactions: reactionsCopy,
|
|
Priority: postPriorityCopy,
|
|
Acknowledgements: acknowledgementsCopy,
|
|
}
|
|
}
|