MM-25450 deleted posts should be sanitised (#14769)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
28e58f7088
Коммит
11812ae8e4
@@ -95,7 +95,8 @@ func (a *App) PreparePostForClient(originalPost *model.Post, isNewPost bool, isE
|
||||
post.Metadata = &model.PostMetadata{}
|
||||
|
||||
if post.DeleteAt > 0 {
|
||||
// Don't fill out metadata for deleted posts
|
||||
// For deleted posts we don't fill out metadata nor do we return the post content
|
||||
post.Message = ""
|
||||
return post
|
||||
}
|
||||
|
||||
|
||||
@@ -509,6 +509,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
clientPost := th.App.PreparePostForClient(post, false, false)
|
||||
|
||||
assert.NotEqual(t, nil, clientPost.Metadata, "should've populated Metadata“")
|
||||
assert.Equal(t, "", clientPost.Message, "should've cleaned post content")
|
||||
assert.Nil(t, clientPost.Metadata.Reactions, "should not have populated Reactions")
|
||||
assert.Nil(t, clientPost.Metadata.Files, "should not have populated Files")
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user