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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91fecea2e1b6a6e67244d33b7987768e3134d3e47a7d0480b3fc0144e3b50bbc
4
- data.tar.gz: 2b176fcddda66463b420d8fb7afdecfaee1a24f7c70fbee1526312d947ca735a
3
+ metadata.gz: 4e9d45f1b942d7e3ad80d8fede7d76ab3b1c503d2e752508bf498e0779299a79
4
+ data.tar.gz: ac97b350124abce45eb8d7a875fd99a1252769690b50e72335efdfdb76e19bb6
5
5
  SHA512:
6
- metadata.gz: eeb33ccf9fd047edc82a126bd37705b00a76bfd2cd5f13038e4f31062523a1ec07a83b070b58975d6e999b1dd4e38572f77ac6041a7c3ef5a8223ed03c31e9e9
7
- data.tar.gz: d58746937e8fae613e500bc4a343d92703e2e78f514dd078776927ea4b132de49418adf368d9ea43b05906a1142aa384507f97bbc919a766affd0e51a733b08d
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
@@ -47,3 +47,5 @@ module Noticed
47
47
  end
48
48
  end
49
49
  end
50
+
51
+ ActiveSupport.run_load_hooks :noticed_bulk_delivery_methods_bluesky, Noticed::BulkDeliveryMethods::Bluesky
@@ -9,3 +9,5 @@ module Noticed
9
9
  end
10
10
  end
11
11
  end
12
+
13
+ ActiveSupport.run_load_hooks :noticed_bulk_delivery_methods_discord, Noticed::BulkDeliveryMethods::Discord
@@ -37,3 +37,5 @@ module Noticed
37
37
  end
38
38
  end
39
39
  end
40
+
41
+ ActiveSupport.run_load_hooks :noticed_bulk_delivery_methods_slack, Noticed::BulkDeliveryMethods::Slack
@@ -9,3 +9,5 @@ module Noticed
9
9
  end
10
10
  end
11
11
  end
12
+
13
+ ActiveSupport.run_load_hooks :noticed_bulk_delivery_methods_test, Noticed::BulkDeliveryMethods::Test
@@ -16,3 +16,5 @@ module Noticed
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ ActiveSupport.run_load_hooks :noticed_bulk_delivery_methods_webhook, Noticed::BulkDeliveryMethods::Webhook
@@ -17,3 +17,5 @@ module Noticed
17
17
  end
18
18
  end
19
19
  end
20
+
21
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_action_cable, Noticed::DeliveryMethods::ActionCable
@@ -9,3 +9,5 @@ module Noticed
9
9
  end
10
10
  end
11
11
  end
12
+
13
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_discord, Noticed::DeliveryMethods::Discord
@@ -21,3 +21,5 @@ module Noticed
21
21
  end
22
22
  end
23
23
  end
24
+
25
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_email, Noticed::DeliveryMethods::Email
@@ -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
@@ -91,3 +91,5 @@ module Noticed
91
91
  end
92
92
  end
93
93
  end
94
+
95
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_ios, Noticed::DeliveryMethods::Ios
@@ -13,3 +13,5 @@ module Noticed
13
13
  end
14
14
  end
15
15
  end
16
+
17
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_microsoft_teams, Noticed::DeliveryMethods::MicrosoftTeams
@@ -37,3 +37,5 @@ module Noticed
37
37
  end
38
38
  end
39
39
  end
40
+
41
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_slack, Noticed::DeliveryMethods::Slack
@@ -9,3 +9,5 @@ module Noticed
9
9
  end
10
10
  end
11
11
  end
12
+
13
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_test, Noticed::DeliveryMethods::Test
@@ -41,3 +41,5 @@ module Noticed
41
41
  end
42
42
  end
43
43
  end
44
+
45
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_twilio_messaging, Noticed::DeliveryMethods::TwilioMessaging
@@ -18,3 +18,5 @@ module Noticed
18
18
  end
19
19
  end
20
20
  end
21
+
22
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_vonage_sms, Noticed::DeliveryMethods::VonageSms
@@ -15,3 +15,5 @@ module Noticed
15
15
  end
16
16
  end
17
17
  end
18
+
19
+ ActiveSupport.run_load_hooks :noticed_delivery_methods_webhook, Noticed::DeliveryMethods::Webhook
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.6.2"
2
+ VERSION = "2.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noticed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver