From 7f6609d17b1c16f8967e83bfc172099c1499fbd6 Mon Sep 17 00:00:00 2001 From: fla Date: Sat, 13 Jun 2015 11:03:47 +0200 Subject: [PATCH] Remove old service keys in statistics.json --- app/presenters/statistics_presenter.rb | 20 ---------------- spec/presenters/statistics_presenter_spec.rb | 24 ++++---------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/app/presenters/statistics_presenter.rb b/app/presenters/statistics_presenter.rb index af88e6871..ba4af719f 100644 --- a/app/presenters/statistics_presenter.rb +++ b/app/presenters/statistics_presenter.rb @@ -8,8 +8,6 @@ class StatisticsPresenter base_data.merge(user_counts) .merge(post_counts) .merge(comment_counts) - .merge(all_services) - .merge(legacy_services) # Remove in 0.6 end def base_data @@ -95,28 +93,10 @@ class StatisticsPresenter .count end - def all_services_helper - result = {} - Configuration::KNOWN_SERVICES.each {|service, options| - result[service.to_s] = AppConfig.show_service?(service, nil) - } - result - end - - def all_services - @all_services ||= all_services_helper - end - def available_services Configuration::KNOWN_SERVICES.select {|service| AppConfig.show_service?(service, nil) }.map(&:to_s) end - def legacy_services - Configuration::KNOWN_SERVICES.each_with_object({}) {|service, result| - result[service.to_s] = AppConfig.show_service?(service, nil) - } - end - end diff --git a/spec/presenters/statistics_presenter_spec.rb b/spec/presenters/statistics_presenter_spec.rb index 364525ec0..53e857715 100644 --- a/spec/presenters/statistics_presenter_spec.rb +++ b/spec/presenters/statistics_presenter_spec.rb @@ -25,11 +25,7 @@ describe StatisticsPresenter do "network" => "Diaspora", "version" => AppConfig.version_string, "registrations_open" => AppConfig.settings.enable_registrations?, - "services" => ["facebook"], - "facebook" => true, - "tumblr" => false, - "twitter" => false, - "wordpress" => false + "services" => ["facebook"] ) end @@ -55,11 +51,7 @@ describe StatisticsPresenter do "network" => "Diaspora", "version" => AppConfig.version_string, "registrations_open" => AppConfig.settings.enable_registrations?, - "services" => %w(twitter facebook), - "facebook" => true, - "twitter" => true, - "tumblr" => false, - "wordpress" => false + "services" => %w(twitter facebook) ) end end @@ -89,11 +81,7 @@ describe StatisticsPresenter do "network" => "Diaspora", "version" => AppConfig.version_string, "registrations_open" => AppConfig.settings.enable_registrations?, - "services" => ["twitter"], - "facebook" => false, - "twitter" => true, - "tumblr" => false, - "wordpress" => false + "services" => ["twitter"] ) end end @@ -116,11 +104,7 @@ describe StatisticsPresenter do "active_users_monthly" => User.monthly_actives.count, "local_posts" => @presenter.local_posts, "local_comments" => @presenter.local_comments, - "services" => ["facebook"], - "facebook" => true, - "twitter" => false, - "tumblr" => false, - "wordpress" => false + "services" => ["facebook"] ) end end