Remove spree alerts feature that would check spree website for security alerts

This is not something we need running such an old version of spree
This commit is contained in:
luisramos0
2019-12-02 21:33:43 +00:00
parent f1814f1b67
commit 795f13d73a
7 changed files with 3 additions and 55 deletions

View File

@@ -42,7 +42,6 @@ Metrics/LineLength:
- app/controllers/application_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/adjustments_controller_decorator.rb
- app/controllers/spree/admin/base_controller_decorator.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/credit_cards_controller.rb
@@ -644,6 +643,7 @@ Metrics/ClassLength:
- app/controllers/admin/subscriptions_controller.rb
- app/controllers/api/products_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/base_controller.rb
- app/controllers/spree/admin/payment_methods_controller.rb
- app/controllers/spree/admin/users_controller.rb
- app/controllers/spree/orders_controller.rb

View File

@@ -9,7 +9,6 @@ module Spree
include I18nHelper
before_filter :check_alerts
before_filter :authorize_admin
before_filter :set_locale
before_filter :warn_invalid_order_cycles, if: :html_request?
@@ -77,29 +76,6 @@ module Spree
user.generate_spree_api_key!
end
def check_alerts
return unless should_check_alerts?
return if session.key? :alerts
begin
session[:alerts] = Spree::Alert.current(request.host)
filter_dismissed_alerts
Spree::Config.set last_check_for_spree_alerts: DateTime.now.in_time_zone.to_s
rescue
session[:alerts] = nil
end
end
def should_check_alerts?
return false if !Rails.env.production? || !Spree::Config[:check_for_spree_alerts]
last_check = Spree::Config[:last_check_for_spree_alerts]
return true if last_check.blank?
DateTime.parse(last_check).in_time_zone < 12.hours.ago
end
def flash_message_for(object, event_sym)
resource_desc = object.class.model_name.human
resource_desc += " \"#{object.name}\"" if object.respond_to?(:name) && object.name.present?
@@ -122,13 +98,6 @@ module Spree
raise(ActionController::InvalidAuthenticityToken)
end
def filter_dismissed_alerts
return unless session[:alerts]
dismissed = (Spree::Config[:dismissed_spree_alerts] || '').split(',')
session[:alerts].reject! { |a| dismissed.include? a["id"].to_s }
end
def config_locale
Spree::Backend::Config[:locale]
end

View File

@@ -5,8 +5,7 @@ module Spree
@preferences_general = [:site_name, :default_seo_title, :default_meta_keywords,
:default_meta_description, :site_url, :bugherd_api_key]
@preferences_security = [:allow_ssl_in_production,
:allow_ssl_in_staging, :allow_ssl_in_development_and_test,
:check_for_spree_alerts]
:allow_ssl_in_staging, :allow_ssl_in_development_and_test]
@preferences_currency = [:display_currency, :hide_cents]
end
@@ -20,18 +19,6 @@ module Spree
redirect_to edit_admin_general_settings_path
end
def dismiss_alert
return unless request.xhr? && params[:alert_id]
dismissed = Spree::Config[:dismissed_spree_alerts] || ''
Spree::Config.set(dismissed_spree_alerts: dismissed.
split(',').
push(params[:alert_id]).
join(','))
filter_dismissed_alerts
render nothing: true
end
end
end
end

View File

@@ -16,8 +16,6 @@
= Spree.t(:loading)
\...
= render :partial => 'spree/admin/shared/alert', :collection => session[:alerts]
%header#header{"data-hook" => ""}
.container
%figure.columns.five{"data-hook" => "logo-wrapper"}

View File

@@ -14,7 +14,6 @@
.progress-message
= t(:loading)
\...
= render :partial => 'spree/admin/shared/alert', :collection => session[:alerts]
%header#header{"data-hook" => ""}
.container

View File

@@ -2851,7 +2851,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using
allow_ssl_in_development_and_test: "Allow SSL to be used when in development and test modes"
allow_ssl_in_production: "Allow SSL to be used in production mode"
allow_ssl_in_staging: "Allow SSL to be used in staging mode"
check_for_spree_alerts: "Check for Spree alerts"
currency_decimal_mark: "Currency decimal mark"
currency_settings: "Currency Settings"
currency_symbol_position: Put "currency symbol before or after dollar amount?"

View File

@@ -84,11 +84,7 @@ Spree::Core::Engine.routes.prepend do
end
# Configuration section
resource :general_settings do
collection do
post :dismiss_alert
end
end
resource :general_settings
resource :mail_method, :only => [:edit, :update] do
post :testmail, :on => :collection
end