MM-13015 Remove metadata field from post when metadata is disabled (#9882)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
79f1c1d44c
Коммит
385a0048bf
@@ -402,6 +402,10 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
post = th.App.PreparePostForClient(post)
|
||||
|
||||
assert.Nil(t, post.Metadata)
|
||||
|
||||
b := post.ToJson()
|
||||
|
||||
assert.NotContains(t, string(b), "metadata", "json shouldn't include a metadata field, not even a falsey one")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ type Post struct {
|
||||
HasReactions bool `json:"has_reactions,omitempty"`
|
||||
|
||||
// Transient data populated before sending a post to the client
|
||||
Metadata *PostMetadata `json:"metadata" db:"-"`
|
||||
Metadata *PostMetadata `json:"metadata,omitempty" db:"-"`
|
||||
}
|
||||
|
||||
type PostEphemeral struct {
|
||||
|
||||
Ссылка в новой задаче
Block a user