From 6ec514167e00c50419f7c6f0e8b1d3a0f59e3545 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 26 Nov 2012 17:24:21 +1300 Subject: [PATCH] Removed store_current_location! related code completely. Not a needed feature and it removes overhead. --- core/app/helpers/refinery/site_bar_helper.rb | 12 ++---------- core/lib/refinery/application_controller.rb | 12 ------------ .../controllers/refinery/admin/images_controller.rb | 4 ---- .../testing/controller_macros/authentication.rb | 2 +- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/core/app/helpers/refinery/site_bar_helper.rb b/core/app/helpers/refinery/site_bar_helper.rb index f53beec903..038045959d 100644 --- a/core/app/helpers/refinery/site_bar_helper.rb +++ b/core/app/helpers/refinery/site_bar_helper.rb @@ -4,17 +4,9 @@ module SiteBarHelper # Generates the link to determine where the site bar switch button returns to. def site_bar_switch_link link_to_if(admin?, t('.switch_to_your_website', site_bar_translate_locale_args), - (if session.keys.map(&:to_sym).include?(:website_return_to) and session[:website_return_to].present? - session[:website_return_to] - else - refinery.root_path(site_bar_translate_locale_args) - end)) do + refinery.root_path(site_bar_translate_locale_args)) do link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args), - (if session.keys.map(&:to_sym).include?(:refinery_return_to) and session[:refinery_return_to].present? - session[:refinery_return_to] - else - refinery.admin_root_path - end rescue refinery.admin_root_path) + refinery.admin_root_path end end diff --git a/core/lib/refinery/application_controller.rb b/core/lib/refinery/application_controller.rb index 954e4b87f0..3fdcf8fa13 100644 --- a/core/lib/refinery/application_controller.rb +++ b/core/lib/refinery/application_controller.rb @@ -19,9 +19,6 @@ module ApplicationController send :before_filter, :force_ssl?, :if => :admin? - send :after_filter, :store_current_location!, - :if => Proc.new {|c| send(:refinery_user?) } - if Refinery::Core.rescue_not_found send :rescue_from, ActiveRecord::RecordNotFound, ::AbstractController::ActionNotFound, @@ -87,14 +84,5 @@ def refinery_user_required? redirect_to refinery.signup_path end end - - private - - def store_current_location! - if admin? && request.get? && !request.xhr? && !from_dialog? - # ensure that we don't redirect to AJAX or POST/PUT/DELETE urls - session[:refinery_return_to] = request.path.sub('//', '/') - end - end end end diff --git a/images/app/controllers/refinery/admin/images_controller.rb b/images/app/controllers/refinery/admin/images_controller.rb index 87a94d107f..f0a3c9c9aa 100644 --- a/images/app/controllers/refinery/admin/images_controller.rb +++ b/images/app/controllers/refinery/admin/images_controller.rb @@ -139,10 +139,6 @@ def restrict_controller super unless action_name == 'insert' end - def store_current_location! - super unless action_name == 'insert' or from_dialog? - end - end end end diff --git a/testing/lib/refinery/testing/controller_macros/authentication.rb b/testing/lib/refinery/testing/controller_macros/authentication.rb index f2de64b040..bf1f867eb0 100644 --- a/testing/lib/refinery/testing/controller_macros/authentication.rb +++ b/testing/lib/refinery/testing/controller_macros/authentication.rb @@ -34,10 +34,10 @@ def mock_user(roles) before do controller.should_receive(:refinery_user_required?).and_return false - controller.should_receive(:refinery_user?).and_return true controller.should_receive(:authenticate_refinery_user!).and_return true controller.should_receive(:restrict_plugins).and_return true controller.should_receive(:allow_controller?).and_return controller_permission + controller.stub(:refinery_user?).and_return true controller.stub(:current_refinery_user).and_return logged_in_user end end