Skip to content
Extraits de code Groupes Projets
Valider 55d258c5 rédigé par Augier's avatar Augier Validation de Augier
Parcourir les fichiers

Fix registrations displaying

parent aaadf292
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -11,6 +11,14 @@ module StatisticsHelper
end
end
def registrations_status_class statistics
if statistics.open_registrations?
"serv-enabled"
else
"serv-disabled"
end
end
def service_status service, available_services
if available_services.include? service.to_s
I18n.t('statistics.enabled')
......
......@@ -31,7 +31,7 @@ class StatisticsPresenter
end
def open_registrations?
AppConfig.settings.enable_registrations
AppConfig.settings.enable_registrations?
end
def user_counts
......@@ -122,4 +122,4 @@ class StatisticsPresenter
}
end
end
end
\ No newline at end of file
......@@ -7,7 +7,7 @@
= t('_statistics')
= render 'statistics/statistic', name: t('statistics.name'), value: @statistics.name, activated: "serv-enabled"
= render 'statistics/statistic', name: t('statistics.version'), value: @statistics.version, activated: "serv-enabled"
= render 'statistics/statistic', name: t('statistics.registrations'), value: registrations_status(@statistics), activated: "serv-enabled"
= render 'statistics/statistic', name: t('statistics.registrations'), value: registrations_status(@statistics), activated: registrations_status_class(@statistics)
- if @statistics.expose_user_counts?
= render 'statistics/statistic', name: t('statistics.total_users'), value: @statistics.total_users, activated: "serv-enabled"
= render 'statistics/statistic', name: t('statistics.active_users_halfyear'), value: @statistics.halfyear_users, activated: "serv-enabled"
......
......@@ -24,7 +24,7 @@ describe StatisticsPresenter do
"name" => AppConfig.settings.pod_name,
"network" => "Diaspora",
"version" => AppConfig.version_string,
"registrations_open" => AppConfig.settings.enable_registrations,
"registrations_open" => AppConfig.settings.enable_registrations?,
"services"=> ["facebook",],
"facebook" => true,
"tumblr" => false,
......@@ -51,7 +51,7 @@ describe StatisticsPresenter do
"name" => AppConfig.settings.pod_name,
"network" => "Diaspora",
"version" => AppConfig.version_string,
"registrations_open" => AppConfig.settings.enable_registrations,
"registrations_open" => AppConfig.settings.enable_registrations?,
"total_users" => User.count,
"active_users_halfyear" => User.halfyear_actives.count,
"active_users_monthly" => User.monthly_actives.count,
......@@ -65,5 +65,14 @@ describe StatisticsPresenter do
})
end
end
context 'when registrations are closed' do
before do
AppConfig.settings.enable_registrations = false
end
it 'should mark open_registrations to be false' do
expect(@presenter.open_registrations?).to be false
end
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter