Fix services in statistics.json.

Currently there is a bug in configurate that reports incorrectly the services settings if they are set as ENV variables, instead of diaspora.yml settings.
This commit works around that issue by changing the way the setting is fetched.
This commit is contained in:
Jason Robinson 2014-09-22 22:44:22 +03:00
parent 1959f0d939
commit 309e690a66
3 changed files with 6 additions and 5 deletions

View file

@ -51,6 +51,7 @@ The default for including jQuery from a CDN has changed. If you want to continue
* Fix deformed getting started popover [#5227](https://github.com/diaspora/diaspora/pull/5227) * Fix deformed getting started popover [#5227](https://github.com/diaspora/diaspora/pull/5227)
* Use correct locale for invitation subject [#5232](https://github.com/diaspora/diaspora/pull/5232) * Use correct locale for invitation subject [#5232](https://github.com/diaspora/diaspora/pull/5232)
* Initial support for IDN emails * Initial support for IDN emails
* Fix services settings reported by statistics.json [#5256](https://github.com/diaspora/diaspora/pull/5256)
## Features ## Features
* Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105) * Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105)

View file

@ -17,10 +17,8 @@ class StatisticsPresenter
if AppConfig.privacy.statistics.comment_counts? if AppConfig.privacy.statistics.comment_counts?
result['local_comments'] = self.local_comments result['local_comments'] = self.local_comments
end end
AppConfig.services.each do |service, options| AppConfig.services.each do |service, options|
result[service] = options ? !!options["enable"] : false result[service] = AppConfig["services.#{service}.enable"]
end end
result result

View file

@ -18,12 +18,14 @@ describe StatisticsPresenter do
AppConfig.privacy.statistics.user_counts = false AppConfig.privacy.statistics.user_counts = false
AppConfig.privacy.statistics.post_counts = false AppConfig.privacy.statistics.post_counts = false
AppConfig.privacy.statistics.comment_counts = false AppConfig.privacy.statistics.comment_counts = false
AppConfig.services = {"facebook" => nil}
expect(@presenter.as_json).to eq({ expect(@presenter.as_json).to eq({
"name" => AppConfig.settings.pod_name, "name" => AppConfig.settings.pod_name,
"version" => AppConfig.version_string, "version" => AppConfig.version_string,
"registrations_open" => AppConfig.settings.enable_registrations, "registrations_open" => AppConfig.settings.enable_registrations,
"facebook" => false "facebook" => true,
"twitter" => false,
"tumblr" => false,
"wordpress" => false,
}) })
end end