5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:01:42 +00:00

Merge branch 'issue-15188' into 'rails'

feat: recordar la ubicación #15188

See merge request sutty/sutty!256
This commit is contained in:
fauno 2024-04-15 14:24:34 +00:00
commit 73166355a7

View file

@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :notify_unconfirmed_email, unless: :devise_controller?
around_action :set_locale
after_action :store_location!
rescue_from Pundit::NilPolicyError, with: :page_not_found
rescue_from ActionController::RoutingError, with: :page_not_found
@ -115,6 +116,16 @@ class ApplicationController < ActionController::Base
def after_sign_in_path_for(resource)
session[:locale] = nil
sites_path
super
end
# Guardar la ubicación para que devise redirija a donde íbamos, a
# menos que estemos recibiendo información o intentando ingresar.
def store_location!
return if request.xhr?
return unless request.request_method_symbol == :GET
return if devise_controller? && !is_a?(Devise::RegistrationsController) && params[:action] != 'edit'
session[:usuarie_return_to] = request.fullpath
end
end