Exclude sending file metadata to plugin hooks (#18454)
* Exclude sending file metadata to plugin hooks A FileInfo object contained a MiniPreview which is a slice of bytes. This can be particularly costly while marshalling to plugin hooks. We avoid this by refactoring the Embeds and Images population to a separate method and calling that to prevent posts from getting updated. https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=9c0b5413-5401-4ef2-83d5-b9f756585bbc ```release-note NONE ``` * refactor to separate method ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ef639973b7
Коммит
225461fd7e
@@ -297,7 +297,7 @@ func (a *App) CreatePost(c *request.Context, post *model.Post, channel *model.Ch
|
||||
}
|
||||
}
|
||||
|
||||
post = a.PreparePostForClient(post, true, false)
|
||||
post = a.getEmbedsAndImages(post, true)
|
||||
previewPost := post.GetPreviewPost()
|
||||
if previewPost != nil {
|
||||
post.AddProp(model.PostPropsPreviewedPost, previewPost.PostID)
|
||||
@@ -521,7 +521,7 @@ func (a *App) SendEphemeralPost(userID string, post *model.Post) *model.Post {
|
||||
|
||||
post.GenerateActionIds()
|
||||
message := model.NewWebSocketEvent(model.WebsocketEventEphemeralMessage, "", post.ChannelId, userID, nil)
|
||||
post = a.PreparePostForClient(post, true, false)
|
||||
post = a.PreparePostForClientWithEmbedsAndImages(post, true, false)
|
||||
post = model.AddPostActionCookies(post, a.PostActionCookieSecret())
|
||||
|
||||
postJSON, jsonErr := post.ToJSON()
|
||||
@@ -544,7 +544,7 @@ func (a *App) UpdateEphemeralPost(userID string, post *model.Post) *model.Post {
|
||||
|
||||
post.GenerateActionIds()
|
||||
message := model.NewWebSocketEvent(model.WebsocketEventPostEdited, "", post.ChannelId, userID, nil)
|
||||
post = a.PreparePostForClient(post, true, false)
|
||||
post = a.PreparePostForClientWithEmbedsAndImages(post, true, false)
|
||||
post = model.AddPostActionCookies(post, a.PostActionCookieSecret())
|
||||
postJSON, jsonErr := post.ToJSON()
|
||||
if jsonErr != nil {
|
||||
@@ -685,7 +685,7 @@ func (a *App) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool)
|
||||
})
|
||||
}
|
||||
|
||||
rpost = a.PreparePostForClient(rpost, false, true)
|
||||
rpost = a.PreparePostForClientWithEmbedsAndImages(rpost, false, true)
|
||||
|
||||
// Ensure IsFollowing is nil since this updated post will be broadcast to all users
|
||||
// and we don't want to have to populate it for every single user and broadcast to each
|
||||
|
||||
Ссылка в новой задаче
Block a user