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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5a99dfd18ee5650a22a7511b6dc7cd061c4be32dae3d2ab7442174ce226b105
4
- data.tar.gz: dbc832b5abd4f24d57927dec1e5cd5a593498ca4a818609488c0b61355ecba35
3
+ metadata.gz: 778e44febeaea3224b20adfe0848edd074d9bf697abd048a81663746330719b3
4
+ data.tar.gz: 1ff99c78c84f9a9552512b76a0c05d85eeb77d1c4e126eebf93efed8e6877f34
5
5
  SHA512:
6
- metadata.gz: 1c1aa74a2f8d4286a83b1b4b94b1e149999c1769f9512b3990e7e389e637e9c96db4645b041dfd506abb8948b9d9011d59995145ed8fab6c0fffe2901cf8ad50
7
- data.tar.gz: d5e1166331606efb1b6a957c2b004360ad86c9fdae1d3846d2907f625ab52607e96bce3e73c5106910acdeeae4d2733f30e9ed6e43a335e6ecbdb6ada7001016
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
- # config.current_user = ->(request) { nil }
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
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18nProofreading
4
- VERSION = '0.9.4'
4
+ VERSION = '0.9.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_proofreading
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shmarov