Commit ac39e920 authored by Benjamin Neff's avatar Benjamin Neff

Add camo to NodeInfo

closes #7617
parent e4b0b569
......@@ -28,6 +28,7 @@
* Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530)
* Show users vote in polls [#7550](https://github.com/diaspora/diaspora/pull/7550)
* Add explanation of ignore function to in-app help section [#7585](https://github.com/diaspora/diaspora/pull/7585)
* Add camo information to NodeInfo [#7617](https://github.com/diaspora/diaspora/pull/7617)
# 0.7.0.1
......
......@@ -24,6 +24,7 @@ class NodeInfoPresenter
doc.open_registrations = open_registrations?
doc.metadata["nodeName"] = name
doc.metadata["xmppChat"] = chat_enabled?
doc.metadata["camo"] = camo_config
doc.metadata["adminAccount"] = admin_account
end
......@@ -73,6 +74,14 @@ class NodeInfoPresenter
AppConfig.chat.enabled?
end
def camo_config
{
markdown: AppConfig.privacy.camo.proxy_markdown_images?,
opengraph: AppConfig.privacy.camo.proxy_opengraph_thumbnails?,
remotePods: AppConfig.privacy.camo.proxy_remote_pod_images?
}
end
def admin_account
AppConfig.admins.account if AppConfig.admins.account?
end
......
......@@ -39,7 +39,12 @@ describe NodeInfoPresenter do
},
"metadata" => {
"nodeName" => AppConfig.settings.pod_name,
"xmppChat" => AppConfig.chat.enabled?
"xmppChat" => AppConfig.chat.enabled?,
"camo" => {
"markdown" => AppConfig.privacy.camo.proxy_markdown_images?,
"opengraph" => AppConfig.privacy.camo.proxy_opengraph_thumbnails?,
"remotePods" => AppConfig.privacy.camo.proxy_remote_pod_images?
}
}
)
end
......@@ -131,6 +136,22 @@ describe NodeInfoPresenter do
end
end
context "when camo is enabled" do
before do
AppConfig.privacy.camo.proxy_markdown_images = true
AppConfig.privacy.camo.proxy_opengraph_thumbnails = true
AppConfig.privacy.camo.proxy_remote_pod_images = true
end
it "should list enabled camo options in the metadata as true" do
expect(hash).to include "metadata" => include("camo" => {
"markdown" => true,
"opengraph" => true,
"remotePods" => true
})
end
end
context "when admin account is set" do
before do
AppConfig.admins.account = "podmin"
......@@ -160,7 +181,12 @@ describe NodeInfoPresenter do
},
"metadata" => {
"nodeName" => AppConfig.settings.pod_name,
"xmppChat" => AppConfig.chat.enabled?
"xmppChat" => AppConfig.chat.enabled?,
"camo" => {
"markdown" => AppConfig.privacy.camo.proxy_markdown_images?,
"opengraph" => AppConfig.privacy.camo.proxy_opengraph_thumbnails?,
"remotePods" => AppConfig.privacy.camo.proxy_remote_pod_images?
}
}
)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment