From 88bd3a1069db7664404a64868e4f09449c3c7da0 Mon Sep 17 00:00:00 2001 From: Fernando Valverde Date: Fri, 22 Jan 2021 07:54:10 -0600 Subject: [PATCH] Replace authentication_enabled_providers.include? with helper method (#12379) * Replaces authentication_enabled_providers.include? with helper authentication_provider_enabled? * Fix typo --- app/helpers/authentication_helper.rb | 4 ++++ .../_apple_auth_provider_settings.html.erb | 4 ++-- .../configs/_auth_provider_settings.html.erb | 2 +- app/views/admin/configs/show.html.erb | 10 +++++----- spec/helpers/authentication_helper_spec.rb | 17 +++++++++++++++++ 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/helpers/authentication_helper.rb b/app/helpers/authentication_helper.rb index 7d244c7fc..b1980ab38 100644 --- a/app/helpers/authentication_helper.rb +++ b/app/helpers/authentication_helper.rb @@ -15,6 +15,10 @@ module AuthenticationHelper end end + def authentication_provider_enabled?(provider_name) + authentication_enabled_providers.include?(provider_name) + end + def authentication_enabled_providers_for_user(user = current_user) Authentication::Providers.enabled_for_user(user) end diff --git a/app/views/admin/configs/_apple_auth_provider_settings.html.erb b/app/views/admin/configs/_apple_auth_provider_settings.html.erb index bb20ce2da..36252b1ea 100644 --- a/app/views/admin/configs/_apple_auth_provider_settings.html.erb +++ b/app/views/admin/configs/_apple_auth_provider_settings.html.erb @@ -5,7 +5,7 @@ requires a custom partial -->
"> + class="crayons-notice crayons-notice--warning auth-warning <%= authentication_provider_enabled?(provider) ? "hidden" : "" %>"> Note: This authentication provider will not be enabled if the key or secret are missing. Please make sure that you enter your key and secret correctly.
@@ -49,7 +49,7 @@ requires a custom partial placeholder: Constants::SiteConfig::DETAILS[:apple_team_id][:placeholder] %>
- <% if authentication_enabled_providers.include?(provider) %> + <% if authentication_provider_enabled?(provider) %>
- <% if authentication_enabled_providers.include?(provider) %> + <% if authentication_provider_enabled?(provider) %>