livechat 0.3.3 → 0.3.4
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +14 -0
- data/lib/generators/livechat/install/templates/initializer.rb +8 -0
- data/lib/livechat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa83a99e1d1ebe0259347b286862ec7cf7cfffbfe47ea4a624baff36b3ca066e
|
|
4
|
+
data.tar.gz: 0d017808858c6dfbce423e283b061476a74b3075b42bb70c3f10c54fb74b5622
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97dc8a43bfb5ab7fecd0dabdfaf5f126e3346b97e73f56aa96129331046e74355bbc201a7fc0ab010c1ef0e48a73d15ec7aaadac0dd185c4310480271486984c
|
|
7
|
+
data.tar.gz: e1469a54e206b39b539d6dacc767568caad7a44da3540d5ff3b746fb0affb74e83224f3ca9f0ea87163f2796656d66b274aaa58332e1cd40ddfda9b441b1028d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.4
|
|
4
|
+
|
|
5
|
+
- Docs: show how to wire `current_user` with Rails 8's built-in authentication
|
|
6
|
+
(`bin/rails generate authentication`), alongside the existing Devise/Warden
|
|
7
|
+
example — in the README and the generated initializer.
|
|
8
|
+
|
|
3
9
|
## 0.3.3
|
|
4
10
|
|
|
5
11
|
- Accessibility: on phones (where the panel is a full-screen modal) focus is
|
data/README.md
CHANGED
|
@@ -91,6 +91,20 @@ Livechat.configure do |config|
|
|
|
91
91
|
end
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
`current_user` (and any admin gate) receives the raw request, so it works
|
|
95
|
+
with whatever auth you have:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
# Devise / Warden:
|
|
99
|
+
config.current_user = ->(request) { request.env["warden"]&.user }
|
|
100
|
+
|
|
101
|
+
# Rails 8 built-in auth (bin/rails generate authentication):
|
|
102
|
+
config.current_user = lambda do |request|
|
|
103
|
+
token = request.cookies["session_token"]
|
|
104
|
+
Session.find_signed(token)&.user if token
|
|
105
|
+
end
|
|
106
|
+
```
|
|
107
|
+
|
|
94
108
|
### Brand color
|
|
95
109
|
|
|
96
110
|
```ruby
|
|
@@ -16,7 +16,15 @@ Livechat.configure do |config|
|
|
|
16
16
|
# Resolve the current user (optional). Return an object responding to #id,
|
|
17
17
|
# or nil. Signed-in visitors keep one conversation across devices; guests
|
|
18
18
|
# are tracked with a cookie. The same user is the agent when replying.
|
|
19
|
+
#
|
|
20
|
+
# Devise / Warden:
|
|
19
21
|
# config.current_user = ->(request) { request.env["warden"]&.user }
|
|
22
|
+
#
|
|
23
|
+
# Rails 8 built-in auth (bin/rails generate authentication):
|
|
24
|
+
# config.current_user = lambda do |request|
|
|
25
|
+
# token = request.cookies["session_token"]
|
|
26
|
+
# Session.find_signed(token)&.user if token
|
|
27
|
+
# end
|
|
20
28
|
|
|
21
29
|
# How visitors appear in the inbox.
|
|
22
30
|
# config.visitor_label = ->(user) { user.name.presence || user.email }
|
data/lib/livechat/version.rb
CHANGED