noticed 2.6.2 → 2.7.1
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/README.md +21 -0
- data/app/models/concerns/noticed/deliverable.rb +2 -2
- data/lib/noticed/bulk_delivery_methods/bluesky.rb +2 -0
- data/lib/noticed/bulk_delivery_methods/discord.rb +2 -0
- data/lib/noticed/bulk_delivery_methods/slack.rb +2 -0
- data/lib/noticed/bulk_delivery_methods/test.rb +2 -0
- data/lib/noticed/bulk_delivery_methods/webhook.rb +2 -0
- data/lib/noticed/delivery_methods/action_cable.rb +2 -0
- data/lib/noticed/delivery_methods/discord.rb +2 -0
- data/lib/noticed/delivery_methods/email.rb +2 -0
- data/lib/noticed/delivery_methods/fcm.rb +4 -0
- data/lib/noticed/delivery_methods/ios.rb +2 -0
- data/lib/noticed/delivery_methods/microsoft_teams.rb +2 -0
- data/lib/noticed/delivery_methods/slack.rb +2 -0
- data/lib/noticed/delivery_methods/test.rb +2 -0
- data/lib/noticed/delivery_methods/twilio_messaging.rb +2 -0
- data/lib/noticed/delivery_methods/vonage_sms.rb +2 -0
- data/lib/noticed/delivery_methods/webhook.rb +2 -0
- data/lib/noticed/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: 4e9d45f1b942d7e3ad80d8fede7d76ab3b1c503d2e752508bf498e0779299a79
|
4
|
+
data.tar.gz: ac97b350124abce45eb8d7a875fd99a1252769690b50e72335efdfdb76e19bb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cc04c25fad32bd8bfe44d231b0dc51c59f4f248d4125885def6867d158d18d33bd0389f69d6ced75ed8fb65096b43be22ed12ca6f1995e1d2a02860f2ce2bc5
|
7
|
+
data.tar.gz: c5a3baa9b0f010f9d592e3fb42b185dad515595768a451763eab62954e987989e128b7d6b1fa27abe3ab5f2d362bb13e93d464b50f022d763d4cbd28bd16e183
|
data/README.md
CHANGED
@@ -493,6 +493,27 @@ module MyApp
|
|
493
493
|
end
|
494
494
|
```
|
495
495
|
|
496
|
+
#### Tip: Custom properties on a notification per recipient
|
497
|
+
|
498
|
+
In order to have recipient-specific settings on the notification, override the `recipient_attributes_for(recipient)` method in your notifier:
|
499
|
+
|
500
|
+
```ruby
|
501
|
+
class CommentNotifier < ApplicationNotifier
|
502
|
+
#...
|
503
|
+
def recipient_attributes_for(recipient)
|
504
|
+
data = super
|
505
|
+
data[:priority] = if recipient.participant?
|
506
|
+
"high"
|
507
|
+
else
|
508
|
+
"low"
|
509
|
+
end
|
510
|
+
data
|
511
|
+
end
|
512
|
+
end
|
513
|
+
```
|
514
|
+
|
515
|
+
Assuming you have a `priority` column in the `noticed_notifications` table, it will be set to the value from the hash here. The default properties of the hash are `recipient_type` and `recipient_id`.
|
516
|
+
|
496
517
|
## ✅ Best Practices
|
497
518
|
|
498
519
|
### Renaming Notifiers
|
@@ -118,9 +118,9 @@ module Noticed
|
|
118
118
|
def evaluate_recipients
|
119
119
|
return unless _recipients
|
120
120
|
|
121
|
-
if _recipients.respond_to?(:call)
|
121
|
+
if _recipients.respond_to?(:call, true)
|
122
122
|
instance_exec(&_recipients)
|
123
|
-
elsif _recipients.is_a?(Symbol) && respond_to?(_recipients)
|
123
|
+
elsif _recipients.is_a?(Symbol) && respond_to?(_recipients, true)
|
124
124
|
send(_recipients)
|
125
125
|
end
|
126
126
|
end
|
@@ -18,6 +18,8 @@ module Noticed
|
|
18
18
|
rescue Noticed::ResponseUnsuccessful => exception
|
19
19
|
if bad_token?(exception.response) && config[:invalid_token]
|
20
20
|
notification.instance_exec(device_token, &config[:invalid_token])
|
21
|
+
elsif config[:error_handler]
|
22
|
+
notification.instance_exec(exception.response, &config[:error_handler])
|
21
23
|
else
|
22
24
|
raise
|
23
25
|
end
|
@@ -66,3 +68,5 @@ module Noticed
|
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
71
|
+
|
72
|
+
ActiveSupport.run_load_hooks :noticed_delivery_methods_fcm, Noticed::DeliveryMethods::Fcm
|
data/lib/noticed/version.rb
CHANGED