Merge pull request #5296 from 'deepy/develop' into develop

This commit is contained in:
Jason Robinson 2014-10-12 22:39:48 +03:00
commit 13de3f318e
2 changed files with 6 additions and 2 deletions

View file

@ -4,7 +4,8 @@ class StatisticsPresenter
result = { result = {
'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,
'services' => []
} }
if AppConfig.privacy.statistics.user_counts? if AppConfig.privacy.statistics.user_counts?
result['total_users'] = User.count result['total_users'] = User.count
@ -17,6 +18,7 @@ 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
result["services"] = Configuration::KNOWN_SERVICES.select {|service| AppConfig["services.#{service}.enable"]}.map(&:to_s)
Configuration::KNOWN_SERVICES.each do |service, options| Configuration::KNOWN_SERVICES.each do |service, options|
result[service.to_s] = AppConfig["services.#{service}.enable"] result[service.to_s] = AppConfig["services.#{service}.enable"]
end end

View file

@ -24,9 +24,10 @@ describe StatisticsPresenter do
"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,
"services"=> ["facebook",],
"facebook" => true, "facebook" => true,
"twitter" => false,
"tumblr" => false, "tumblr" => false,
"twitter" => false,
"wordpress" => false, "wordpress" => false,
}) })
end end
@ -54,6 +55,7 @@ describe StatisticsPresenter do
"active_users_monthly" => User.monthly_actives.count, "active_users_monthly" => User.monthly_actives.count,
"local_posts" => @presenter.local_posts, "local_posts" => @presenter.local_posts,
"local_comments" => @presenter.local_comments, "local_comments" => @presenter.local_comments,
"services" => ["twitter","facebook"],
"facebook" => true, "facebook" => true,
"twitter" => true, "twitter" => true,
"tumblr" => false, "tumblr" => false,