stealth 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/stealth/controller/controller.rb +5 -0
- data/lib/stealth/session.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f83e4487628f655994dec39aeb5258a3ea025d44a3cac4246f96601ab97ce47
|
4
|
+
data.tar.gz: 5aacfce7dffa452760ec58a2039c02942a7505f8dcc7c86d145b9c7c14f8afbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fbffa4f483f158a5d9bb64ef7ded968467ff923ec59e7dbb330472e8d88a53a96d686af805a37c6124cf9465a7ebe74bef82d22dc65447c65c2e861d1e5e982
|
7
|
+
data.tar.gz: 4addf66269c126893d698b0b42e3ff285d90619ea71b38e36ed45e2ea82641a7504a1b23dd6e948627653ce7bedbffd2a12e8c0f5ed0b08dc5299e671fc46b67
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.2
|
@@ -105,6 +105,7 @@ module Stealth
|
|
105
105
|
end
|
106
106
|
|
107
107
|
Stealth::ScheduledReplyJob.perform_in(delay, current_service, current_user_id, flow, state)
|
108
|
+
Stealth::Logger.l(topic: "session", message: "User #{current_user_id}: scheduled session step to #{flow}->#{state} in #{delay} seconds")
|
108
109
|
end
|
109
110
|
|
110
111
|
def step_to(session: nil, flow: nil, state: nil)
|
@@ -160,12 +161,16 @@ module Stealth
|
|
160
161
|
end
|
161
162
|
|
162
163
|
def update_session(flow:, state:)
|
164
|
+
Stealth::Logger.l(topic: "session", message: "User #{current_user_id}: updating session to #{flow}->#{state}")
|
165
|
+
|
163
166
|
@current_session = Stealth::Session.new(user_id: current_user_id)
|
164
167
|
@progressed = :updated_session
|
165
168
|
@current_session.set(flow: flow, state: state)
|
166
169
|
end
|
167
170
|
|
168
171
|
def step(flow:, state:)
|
172
|
+
Stealth::Logger.l(topic: "session", message: "User #{current_user_id}: stepping to #{flow}->#{state}")
|
173
|
+
|
169
174
|
update_session(flow: flow, state: state)
|
170
175
|
@progressed = :stepped
|
171
176
|
@flow_controller = nil
|
data/lib/stealth/session.rb
CHANGED
@@ -59,7 +59,7 @@ module Stealth
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def set(flow:, state:)
|
62
|
-
store_current_to_previous
|
62
|
+
store_current_to_previous(flow: flow, state: state)
|
63
63
|
|
64
64
|
@flow = nil
|
65
65
|
@session = canonical_session_slug(flow: flow, state: state)
|
@@ -109,8 +109,16 @@ module Stealth
|
|
109
109
|
[user_id, 'previous'].join('-')
|
110
110
|
end
|
111
111
|
|
112
|
-
def store_current_to_previous
|
113
|
-
|
112
|
+
def store_current_to_previous(flow:, state:)
|
113
|
+
new_session = canonical_session_slug(flow: flow, state: state)
|
114
|
+
|
115
|
+
# Prevent previous_session from becoming current_session
|
116
|
+
if new_session == session
|
117
|
+
Stealth::Logger.l(topic: "previous_session", message: "User #{user_id}: skipping setting to #{session} because it is the same as current_session")
|
118
|
+
else
|
119
|
+
Stealth::Logger.l(topic: "previous_session", message: "User #{user_id}: setting to #{session}")
|
120
|
+
$redis.set(previous_session_key(user_id: user_id), session)
|
121
|
+
end
|
114
122
|
end
|
115
123
|
|
116
124
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stealth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauricio Gomes
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.7.3
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Ruby framework for conversational bots
|