effective_resources 2.19.7 → 2.19.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 755f35cecf11e51a68cc1a998a6f14ffcb60fc7f790b19989c569d7015f7082a
4
- data.tar.gz: 28c81ad69b69c2ded6d458fde80921453777745d58d5828c81b411add7e3ac76
3
+ metadata.gz: a64aa8daa41dc12a1702ee128d8a972ec46a005f616f2091f9821075c817f9c7
4
+ data.tar.gz: c59a857b8b39855a74bfda837b59c259d92b192081c9af65947ad22de202d074
5
5
  SHA512:
6
- metadata.gz: f734ba1bb834a8337d0ca537db43576f8290ed067653405394a8784110e137f10d885436c706c368452265282d78932cfa7824dff2b1f7f196298c06fc29ac0a
7
- data.tar.gz: dee4966d4485ccfac7daecc4afb41cc77571d696298c5f075334de9b27b6ec11496f361ecee3528335801a3b81a09d8172b941bf3c403dda958118629693baa6
6
+ metadata.gz: 71b49bf9d7152eeee999e1fffec4020355274f140c6c6e3bc4757cc8c69716808816bff5bf96b8332028ddedbf8ef24633616ea827118154bd7935aa0804a83a
7
+ data.tar.gz: 1ff8ec49ce929e048e9582134447046c03448c7d0a2d0fb794c6024e83a03d705a9193a63336bd6fd7d4b0e64f1e08e44ceb2f54de281c175f3de0cb344170ac
@@ -72,10 +72,22 @@ module Effective
72
72
  def referer_redirect_path
73
73
  url = request.referer.to_s
74
74
 
75
- return if (resource && resource.respond_to?(:destroyed?) && resource.destroyed? && url.include?("/#{resource.to_param}"))
75
+ # Referer may not always be present
76
+ return if url.blank?
77
+
78
+ # Don't redirect back to this resource's show or edit page
79
+ if resource.try(:destroyed?)
80
+ to_param = (resource.to_param || resource.try(:token) || resource.try(:slug) || resource.id) # to_param is nil sometimes
81
+ return if to_param.present? && url.include?("/#{to_param}")
82
+ end
83
+
84
+ # Don't redirect back if we're on duplicate action
76
85
  return if url.include?('duplicate_id=')
77
- return unless (Rails.application.routes.recognize_path(URI(url).path) rescue false)
78
86
 
87
+ # Don't redirect unless we recognize the url
88
+ return unless (Rails.application.routes.recognize_path(url) rescue false) || (Rails.application.routes.recognize_path(URI(url).path) rescue false)
89
+
90
+ # Redirect to this recognized url
79
91
  url
80
92
  end
81
93
 
@@ -3,12 +3,12 @@ module Effective
3
3
  module Destroy
4
4
 
5
5
  def destroy
6
- # Reset impersonation
7
- session[:impersonation_user_id] = nil
8
- session[:impersonation_original_path] = nil
9
-
10
6
  # Edge case where the current_user is blank. Weird session data.
11
7
  if current_user.blank?
8
+ # Reset impersonation
9
+ session[:impersonation_user_id] = nil
10
+ session[:impersonation_original_path] = nil
11
+
12
12
  redirect_to(root_path) and return
13
13
  end
14
14
 
@@ -16,6 +16,10 @@ module Effective
16
16
  @user = current_user.class.find(session[:impersonation_user_id])
17
17
  redirect_path = after_destroy_impersonate_path_for(@user)
18
18
 
19
+ # Reset impersonation
20
+ session[:impersonation_user_id] = nil
21
+ session[:impersonation_original_path] = nil
22
+
19
23
  expire_data_after_sign_in!
20
24
  warden.session_serializer.store(@user, Devise::Mapping.find_scope!(@user))
21
25
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.19.7'.freeze
2
+ VERSION = '2.19.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.7
4
+ version: 2.19.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubygems_version: 3.4.10
291
+ rubygems_version: 3.5.6
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: Make any controller an effective resource controller.