i18n_proofreading 0.9.4 → 0.9.5
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 +16 -0
- data/lib/generators/i18n_proofreading/install/templates/initializer.rb +8 -1
- data/lib/i18n_proofreading/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: 778e44febeaea3224b20adfe0848edd074d9bf697abd048a81663746330719b3
|
|
4
|
+
data.tar.gz: 1ff99c78c84f9a9552512b76a0c05d85eeb77d1c4e126eebf93efed8e6877f34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1566a643ca08b52aa561ff50802eeeac730a6b813c3190e2b556616c57b5ada7c69ace02d87acd2148e2adead6766c5f3c09a76487db221f1e287cc5a6c7e165
|
|
7
|
+
data.tar.gz: 4b7c2b2a5d7f90e3477624879aaf61c7bbc5e401903abd9f595f3cfbc7efb5818c2f300a18c7efb69165ca8c72b0caa683353b77c7c54960d1c214823d72485b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.5]
|
|
6
|
+
|
|
7
|
+
- Docs: show how to wire `current_user` with Rails 8's built-in authentication
|
|
8
|
+
(`bin/rails generate authentication`), alongside the Devise/Warden example —
|
|
9
|
+
in the README and the generated initializer.
|
|
10
|
+
|
|
5
11
|
## [0.9.4]
|
|
6
12
|
|
|
7
13
|
- **Accessibility parity for the suggestion popover.** The panel is now a real
|
data/README.md
CHANGED
|
@@ -181,6 +181,22 @@ config.enabled = ->(request) { request.env["warden"]&.user&.staff? }
|
|
|
181
181
|
config.enabled = ->(request) { Flipper.enabled?(:i18n_proofreading) }
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
### Resolving the current user
|
|
185
|
+
|
|
186
|
+
`current_user` (optional — it attributes suggestions) and the gates all
|
|
187
|
+
receive the raw request, so they work with whatever auth you have:
|
|
188
|
+
|
|
189
|
+
```ruby
|
|
190
|
+
# Devise / Warden:
|
|
191
|
+
config.current_user = ->(request) { request.env["warden"]&.user }
|
|
192
|
+
|
|
193
|
+
# Rails 8 built-in auth (bin/rails generate authentication):
|
|
194
|
+
config.current_user = lambda do |request|
|
|
195
|
+
token = request.cookies["session_token"]
|
|
196
|
+
Session.find_signed(token)&.user if token
|
|
197
|
+
end
|
|
198
|
+
```
|
|
199
|
+
|
|
184
200
|
### Placing the widget yourself
|
|
185
201
|
|
|
186
202
|
Set `config.auto_inject = false` and drop the helper at the end of your layout:
|
|
@@ -21,7 +21,14 @@ I18nProofreading.configure do |config|
|
|
|
21
21
|
# #id (ideally #email too), or nil. Receives the Rack::Request. You resolve the
|
|
22
22
|
# user however your app does — session, Warden, a token, etc.
|
|
23
23
|
#
|
|
24
|
-
#
|
|
24
|
+
# Devise / Warden:
|
|
25
|
+
# config.current_user = ->(request) { request.env["warden"]&.user }
|
|
26
|
+
#
|
|
27
|
+
# Rails 8 built-in auth (bin/rails generate authentication):
|
|
28
|
+
# config.current_user = lambda do |request|
|
|
29
|
+
# token = request.cookies["session_token"]
|
|
30
|
+
# Session.find_signed(token)&.user if token
|
|
31
|
+
# end
|
|
25
32
|
|
|
26
33
|
# How to label the author in the "already suggested" list.
|
|
27
34
|
#
|