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

View file

@ -24,9 +24,10 @@ describe StatisticsPresenter do
"name" => AppConfig.settings.pod_name,
"version" => AppConfig.version_string,
"registrations_open" => AppConfig.settings.enable_registrations,
"services"=> ["facebook",],
"facebook" => true,
"twitter" => false,
"tumblr" => false,
"twitter" => false,
"wordpress" => false,
})
end
@ -54,6 +55,7 @@ describe StatisticsPresenter do
"active_users_monthly" => User.monthly_actives.count,
"local_posts" => @presenter.local_posts,
"local_comments" => @presenter.local_comments,
"services" => ["twitter","facebook"],
"facebook" => true,
"twitter" => true,
"tumblr" => false,