MM-16228 Remove DisablePostMetadata setting (#11138)

* MM-16228 Remove DisablePostMetadata setting

* Remove DEPRECATED_DO_NOT_USE_DisablePostMetadata
Этот коммит содержится в:
Harrison Healey
2019-06-13 17:32:36 -04:00
коммит произвёл GitHub
родитель 6f0b2c52cf
Коммит ff0696c667
6 изменённых файлов: 1 добавлений и 38 удалений

Просмотреть файл

@@ -537,7 +537,6 @@ func (a *App) trackConfig() {
a.SendDiagnostic(TRACK_CONFIG_EXPERIMENTAL, map[string]interface{}{
"client_side_cert_enable": *cfg.ExperimentalSettings.ClientSideCertEnable,
"isdefault_client_side_cert_check": isDefault(*cfg.ExperimentalSettings.ClientSideCertCheck, model.CLIENT_SIDE_CERT_CHECK_PRIMARY_AUTH),
"enable_post_metadata": !*cfg.ExperimentalSettings.DisablePostMetadata,
"link_metadata_timeout_milliseconds": *cfg.ExperimentalSettings.LinkMetadataTimeoutMilliseconds,
"enable_click_to_reply": *cfg.ExperimentalSettings.EnableClickToReply,
"restrict_system_admin": *cfg.ExperimentalSettings.RestrictSystemAdmin,

Просмотреть файл

@@ -59,10 +59,6 @@ func (a *App) PreparePostForClient(originalPost *model.Post, isNewPost bool, isE
// Proxy image links before constructing metadata so that requests go through the proxy
post = a.PostWithProxyAddedToImageURLs(post)
if *a.Config().ExperimentalSettings.DisablePostMetadata {
return post
}
post.Metadata = &model.PostMetadata{}
// Emojis and reaction counts

Просмотреть файл

@@ -32,10 +32,6 @@ func TestPreparePostListForClient(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ExperimentalSettings.DisablePostMetadata = false
})
postList := model.NewPostList()
for i := 0; i < 5; i++ {
postList.AddPost(&model.Post{})
@@ -68,7 +64,6 @@ func TestPreparePostForClient(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.EnableLinkPreviews = true
*cfg.ImageProxySettings.Enable = false
*cfg.ExperimentalSettings.DisablePostMetadata = false
})
return th
@@ -393,24 +388,6 @@ func TestPreparePostForClient(t *testing.T) {
}, imageDimensions["https://github.com/hmhealey/test-files/raw/master/icon.png"])
})
})
t.Run("when disabled", func(t *testing.T) {
th := setup()
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ExperimentalSettings.DisablePostMetadata = true
})
post := th.CreatePost(th.BasicChannel)
post = th.App.PreparePostForClient(post, false, false)
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")
})
}
func TestPreparePostForClientWithImageProxy(t *testing.T) {
@@ -424,7 +401,6 @@ func TestPreparePostForClientWithImageProxy(t *testing.T) {
*cfg.ImageProxySettings.ImageProxyType = "atmos/camo"
*cfg.ImageProxySettings.RemoteImageProxyURL = "https://127.0.0.1"
*cfg.ImageProxySettings.RemoteImageProxyOptions = "foo"
*cfg.ExperimentalSettings.DisablePostMetadata = false
})
return th

Просмотреть файл

@@ -668,7 +668,6 @@ func TestCreatePost(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.SiteURL = "http://mymattermost.com"
*cfg.ExperimentalSettings.DisablePostMetadata = true
*cfg.ImageProxySettings.Enable = true
*cfg.ImageProxySettings.ImageProxyType = "atmos/camo"
*cfg.ImageProxySettings.RemoteImageProxyURL = "https://127.0.0.1"
@@ -697,7 +696,6 @@ func TestPatchPost(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.SiteURL = "http://mymattermost.com"
*cfg.ExperimentalSettings.DisablePostMetadata = true
*cfg.ImageProxySettings.Enable = true
*cfg.ImageProxySettings.ImageProxyType = "atmos/camo"
*cfg.ImageProxySettings.RemoteImageProxyURL = "https://127.0.0.1"
@@ -747,7 +745,6 @@ func TestUpdatePost(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.SiteURL = "http://mymattermost.com"
*cfg.ExperimentalSettings.DisablePostMetadata = true
*cfg.ImageProxySettings.Enable = true
*cfg.ImageProxySettings.ImageProxyType = "atmos/camo"
*cfg.ImageProxySettings.RemoteImageProxyURL = "https://127.0.0.1"