diff --git a/Changelog.md b/Changelog.md index 754f3c230..d1454b9e1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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) * Use correct locale for invitation subject [#5232](https://github.com/diaspora/diaspora/pull/5232) * Initial support for IDN emails +* Fix services settings reported by statistics.json [#5256](https://github.com/diaspora/diaspora/pull/5256) ## Features * Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105) diff --git a/app/presenters/statistics_presenter.rb b/app/presenters/statistics_presenter.rb index e07dcc6e0..b264fc3af 100644 --- a/app/presenters/statistics_presenter.rb +++ b/app/presenters/statistics_presenter.rb @@ -17,10 +17,8 @@ class StatisticsPresenter if AppConfig.privacy.statistics.comment_counts? result['local_comments'] = self.local_comments end - AppConfig.services.each do |service, options| - result[service] = options ? !!options["enable"] : false - + result[service] = AppConfig["services.#{service}.enable"] end result diff --git a/spec/presenters/statistics_presenter_spec.rb b/spec/presenters/statistics_presenter_spec.rb index 61359752e..a223ecb66 100644 --- a/spec/presenters/statistics_presenter_spec.rb +++ b/spec/presenters/statistics_presenter_spec.rb @@ -18,12 +18,14 @@ describe StatisticsPresenter do AppConfig.privacy.statistics.user_counts = false AppConfig.privacy.statistics.post_counts = false AppConfig.privacy.statistics.comment_counts = false - AppConfig.services = {"facebook" => nil} expect(@presenter.as_json).to eq({ "name" => AppConfig.settings.pod_name, "version" => AppConfig.version_string, "registrations_open" => AppConfig.settings.enable_registrations, - "facebook" => false + "facebook" => true, + "twitter" => false, + "tumblr" => false, + "wordpress" => false, }) end