i18n_feedback 0.3.1 → 0.4.0
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 +10 -0
- data/app/controllers/i18n_feedback/suggestions_controller.rb +1 -0
- data/lib/generators/i18n_feedback/install/templates/initializer.rb +5 -0
- data/lib/i18n_feedback/configuration.rb +5 -0
- data/lib/i18n_feedback/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: f4dee71413e641b59a88d1116ac134410395055d31f097d83800155feead9fc8
|
|
4
|
+
data.tar.gz: 4e41cd76dd83acbdd77ff95ece48bed916040bdf0e6227e78aa6090f8c28025b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9483d2a561d1edb370685c85ac3dfaa5030532c58102aeb923926ea180de687d738e9e7deccbf8a6689f617f4ae7da7a20750272a5306419d60389d574c5b4f4
|
|
7
|
+
data.tar.gz: d50924f6b93eec7fe93bb5e5baa8a7a53a43e8fdcf864b571531646d3f47f8554dff87e6766289ce0589830f0d354176759ea85ebadbff6722396664aec632b9
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.4.0]
|
|
6
|
+
|
|
7
|
+
- Add a `config.on_submit` hook, called with each saved suggestion right after
|
|
8
|
+
it's stored — notify Slack, send an email, open a ticket. Runs inline after
|
|
9
|
+
save, so keep it fast or hand off to a job.
|
|
10
|
+
|
|
5
11
|
## [0.3.1]
|
|
6
12
|
|
|
7
13
|
- Fix the widget showing raw key markers (e.g. `⟦i18n_feedback.title⟧`) in its own
|
data/README.md
CHANGED
|
@@ -234,6 +234,16 @@ end
|
|
|
234
234
|
Each row stores `translation_key`, `locale`, `old_value`, `proposed_value`,
|
|
235
235
|
`comment`, `page_url`, and optional `author_id` / `author_label`.
|
|
236
236
|
|
|
237
|
+
### Getting notified
|
|
238
|
+
|
|
239
|
+
To be pinged when a suggestion comes in, set `on_submit`. It's called with the
|
|
240
|
+
saved `Suggestion` right after it's stored — notify Slack, send an email, open a
|
|
241
|
+
ticket. It runs inline in the request, so keep it fast or hand off to a job:
|
|
242
|
+
|
|
243
|
+
```ruby
|
|
244
|
+
config.on_submit = ->(suggestion) { SuggestionMailer.with(suggestion:).created.deliver_later }
|
|
245
|
+
```
|
|
246
|
+
|
|
237
247
|
## Security
|
|
238
248
|
|
|
239
249
|
- The tool is gated **on the server** for every marker, endpoint, and injection.
|
|
@@ -36,4 +36,9 @@ I18nFeedback.configure do |config|
|
|
|
36
36
|
# Keep this in sync with the `mount` line in config/routes.rb.
|
|
37
37
|
#
|
|
38
38
|
# config.mount_path = "/i18n_feedback"
|
|
39
|
+
|
|
40
|
+
# Called with each saved suggestion — notify Slack, send an email, open a
|
|
41
|
+
# ticket. Runs inline after save, so keep it fast or hand off to a job.
|
|
42
|
+
#
|
|
43
|
+
# config.on_submit = ->(suggestion) { SuggestionMailer.with(suggestion:).created.deliver_later }
|
|
39
44
|
end
|
|
@@ -48,6 +48,10 @@ module I18nFeedback
|
|
|
48
48
|
# suggest mode without the parameter.
|
|
49
49
|
attr_accessor :toggle_param
|
|
50
50
|
|
|
51
|
+
# Called with each saved suggestion — notify Slack, send an email, open a
|
|
52
|
+
# ticket. Runs inline after save; keep it fast or hand off to a job.
|
|
53
|
+
attr_accessor :on_submit
|
|
54
|
+
|
|
51
55
|
def initialize
|
|
52
56
|
@enabled_environments = %w[development staging]
|
|
53
57
|
@enabled = ->(_request) { true }
|
|
@@ -59,6 +63,7 @@ module I18nFeedback
|
|
|
59
63
|
@show_pill = true
|
|
60
64
|
@pill_label = nil
|
|
61
65
|
@toggle_param = 'i18n_feedback'
|
|
66
|
+
@on_submit = ->(_suggestion) {}
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
def environment_enabled?
|