render_turbo_stream 4.3.14 → 4.3.16

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: a7cdf1b3f0af6bf441e0c0d08919985aaa0a83ef49671724860cdb8e6ff45521
4
- data.tar.gz: 23e55905c875439a1203a970fca7a9f72bde401de75d886849ed604213d05db6
3
+ metadata.gz: ab40a8958c762e832bbc38ed03d5a615c8bf41f64c4fd582d09476e373a0fe70
4
+ data.tar.gz: 6863e35d57c45752ee48cb06a057431b9341c1f36d105c66b8f28cd3125a5c2a
5
5
  SHA512:
6
- metadata.gz: 1bfed3d855085bbd4834b5cce5fa13351e3fac306082172b8cc78525c677515b66de762b2291b08c2c25321e5b7c2e52e245560e465e27bb8ff5154029307189
7
- data.tar.gz: d7d0257d9b7210c5f1516cd7fee00765942d6222b32e4ec9338d4c2f452e2ffcce432a7242208045acd7c49fcffedcbdfe7ccabb979fb1b51c7da843fdc5b9db
6
+ metadata.gz: 0e0562b25a98b14b30a3e3a124546e5cba2c8f34e7829f82778549c132606fe34cc6546e9e3ddd92059474e421977684ef99f3c269ca87b36020be056eea1e8f
7
+ data.tar.gz: 85a5453b54b6df7c25333e20ff5bec62fa38758dca6a7e69f4afcf02eb580d5dc129c69588ebffe7c14edc626c493dd8748d657e9bf1d00cc2b5f7cd92ac90ab
@@ -3,7 +3,7 @@ module RenderTurboStream
3
3
 
4
4
  def channel_from_me
5
5
  if current_user
6
- turbo_stream_from "authenticated-user-#{current_user.id}"
6
+ turbo_stream_from "authenticated_user_#{current_user.id}"
7
7
  else
8
8
  Rails.logger.debug(" • SKIP channel_from_me because not authenticated")
9
9
  nil
@@ -12,7 +12,7 @@ module RenderTurboStream
12
12
 
13
13
  def channel_from_authenticated_group(group)
14
14
  if current_user
15
- turbo_stream_from "authenticated-group-#{group}"
15
+ turbo_stream_from "authenticated_group_#{group}"
16
16
  else
17
17
  Rails.logger.debug(" • SKIP channel_from_authenticated_group because not authenticated")
18
18
  nil
@@ -2,7 +2,7 @@ module RenderTurboStream
2
2
  module ControllerChannelHelpers
3
3
 
4
4
  def render_to_all(target_id = nil, action = :replace, partial: nil, template: nil, locals: nil)
5
- evaluate_instance_variables
5
+ #evaluate_instance_variables
6
6
  render_to_channel(
7
7
  'all',
8
8
  target_id,
@@ -26,8 +26,8 @@ module RenderTurboStream
26
26
  end
27
27
 
28
28
  render_to_channel(
29
- "authenticated-user-#{helpers.current_user.id}",
30
- RenderTurboStream::Libs.target_id_to_target(target_id),
29
+ "authenticated_user_#{helpers.current_user.id}",
30
+ target_id,
31
31
  action,
32
32
  partial: partial,
33
33
  locals: locals
@@ -47,8 +47,8 @@ module RenderTurboStream
47
47
  end
48
48
 
49
49
  render_to_channel(
50
- "authenticated-group-#{group}",
51
- RenderTurboStream::Libs.target_id_to_target(target_id),
50
+ "authenticated_group_#{group}",
51
+ target_id,
52
52
  action,
53
53
  partial: partial,
54
54
  locals: locals
@@ -76,7 +76,7 @@ module RenderTurboStream
76
76
  @render_cable_template_was_called = true
77
77
  end
78
78
 
79
- evaluate_instance_variables
79
+ #evaluate_instance_variables
80
80
 
81
81
  libs = RenderTurboStream::ChannelLibs.new(response)
82
82
  libs.render_to_channel(
@@ -107,7 +107,7 @@ module RenderTurboStream
107
107
  return
108
108
  end
109
109
 
110
- action_to_channel("authenticated-user-#{helpers.current_user.id}", action, arguments)
110
+ action_to_channel("authenticated_user_#{helpers.current_user.id}", action, arguments)
111
111
  end
112
112
 
113
113
  def action_to_authenticated_group(group, action, *arguments)
@@ -123,7 +123,7 @@ module RenderTurboStream
123
123
  return
124
124
  end
125
125
 
126
- action_to_channel("authenticated-group-#{group}", action, arguments)
126
+ action_to_channel("authenticated_group_#{group}", action, arguments)
127
127
  end
128
128
 
129
129
  def action_to_channel(channel, command, arguments)
@@ -185,7 +185,11 @@ module RenderTurboStream
185
185
 
186
186
  if save_action
187
187
  if Rails.configuration.x.store_last_saved_object && object.id
188
- session['last_saved_object'] = object.to_global_id
188
+ begin
189
+ session['last_saved_object'] = object.to_global_id
190
+ rescue
191
+ Rails.logger.debug("session['last_saved_object'] = ... failed. You may be in test environent?")
192
+ end
189
193
  end
190
194
  else
191
195
  RenderTurboStream::Libs.debug_save_errors(object, flash_controller_action_name)
@@ -198,7 +202,7 @@ module RenderTurboStream
198
202
  libs = RenderTurboStream::ChannelLibs.new(response)
199
203
  if (helpers.current_user.id rescue false)
200
204
  libs.send_actions_to_channel(
201
- "authenticated-user-#{helpers.current_user.id}",
205
+ "authenticated_user_#{helpers.current_user.id}",
202
206
  turbo_actions,
203
207
  instance_variables: instance_variables
204
208
  )
@@ -67,7 +67,11 @@ module RenderTurboStream
67
67
 
68
68
  if save_action
69
69
  if Rails.configuration.x.store_last_saved_object && object.id
70
- session['last_saved_object'] = object.to_global_id
70
+ begin
71
+ session['last_saved_object'] = object.to_global_id
72
+ rescue
73
+ Rails.logger.debug("session['last_saved_object'] = ... failed. You may be in test environent?")
74
+ end
71
75
  end
72
76
  else
73
77
  response.status = 422
@@ -107,7 +111,7 @@ module RenderTurboStream
107
111
  if allow_channel
108
112
  Rails.logger.debug(" • Send actions through Turbo::StreamsChannel")
109
113
  c_libs = RenderTurboStream::ChannelLibs.new(response)
110
- c_libs.send_actions_to_channel("authenticated-user-#{helpers.current_user.id}", streams, @render_turbo_stream_evaluate_instance_variables)
114
+ c_libs.send_actions_to_channel("authenticated_user_#{helpers.current_user.id}", streams, @render_turbo_stream_evaluate_instance_variables)
111
115
  else
112
116
  flash[:alert] = flashes[:alerts]
113
117
  flash[:notice] = flashes[:notices]
@@ -2,7 +2,7 @@ module RenderTurboStream
2
2
  class Libs
3
3
 
4
4
  def self.target_id_to_target(target_id)
5
- if target_id.present?
5
+ if target_id.present? && !target_id[0] == '#'
6
6
  "##{target_id}"
7
7
  else
8
8
  nil
@@ -7,7 +7,7 @@ module RenderTurboStream
7
7
 
8
8
  def assert_channel_to_me(user, target_id, action: nil, count: 1, &block)
9
9
 
10
- channel = "authenticated-user-#{user.id}"
10
+ channel = "authenticated_user_#{user.id}"
11
11
 
12
12
  libs = RenderTurboStream::Test::Request::Libs.new(response)
13
13
 
@@ -21,7 +21,7 @@ module RenderTurboStream
21
21
 
22
22
  def assert_action_to_me(user, action, count: 1, &block)
23
23
 
24
- channel = "authenticated-user-#{user.id}"
24
+ channel = "authenticated_user_#{user.id}"
25
25
 
26
26
  libs = RenderTurboStream::Test::Request::Libs.new(response)
27
27
 
@@ -37,7 +37,7 @@ module RenderTurboStream
37
37
 
38
38
  def assert_channel_to_authenticated_group(group, target_id, count: 1, &block)
39
39
 
40
- channel = "authenticated-group-#{group}"
40
+ channel = "authenticated_group_#{group}"
41
41
 
42
42
  libs = RenderTurboStream::Test::Request::Libs.new(response)
43
43
 
@@ -51,7 +51,7 @@ module RenderTurboStream
51
51
 
52
52
  def assert_action_to_authenticated_group(group, action, count: 1, &block)
53
53
 
54
- channel = "authenticated-group-#{group}"
54
+ channel = "authenticated_group_#{group}"
55
55
 
56
56
  libs = RenderTurboStream::Test::Request::Libs.new(response)
57
57
 
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "4.3.14"
2
+ VERSION = "4.3.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_turbo_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.14
4
+ version: 4.3.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-18 00:00:00.000000000 Z
11
+ date: 2024-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails