Add system console switch for enabling link previews (#5663)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
f99658152a
Коммит
e87f5c6cf9
@@ -1307,6 +1307,12 @@ func TestGetOpenGraphMetadata(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
Client := th.BasicClient
|
||||
|
||||
enableLinkPreviews := *utils.Cfg.ServiceSettings.EnableLinkPreviews
|
||||
defer func() {
|
||||
*utils.Cfg.ServiceSettings.EnableLinkPreviews = enableLinkPreviews
|
||||
}()
|
||||
*utils.Cfg.ServiceSettings.EnableLinkPreviews = true
|
||||
|
||||
ogDataCacheMissCount := 0
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -1355,4 +1361,9 @@ func TestGetOpenGraphMetadata(t *testing.T) {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
*utils.Cfg.ServiceSettings.EnableLinkPreviews = false
|
||||
if _, err := Client.DoApiPost("/get_opengraph_metadata", "{\"url\":\"/og-data/\"}"); err == nil || err.StatusCode != http.StatusNotImplemented {
|
||||
t.Fatal("should have failed with 501 - disabled link previews")
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user