unotifier 0.2.0 → 0.2.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/Gemfile.lock +1 -1
- data/lib/settings.rb +2 -0
- data/lib/unotifier/version.rb +1 -1
- data/lib/unotifier.rb +10 -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: 0ed6bbfeff3bef2d52c7595a47b48858fc22e09e212ddebce377a2330140936c
|
4
|
+
data.tar.gz: 875927c0296145d3b1c3a0ac2da3c2db85173efd2784607993abb2a7fac9456f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae210ee39d61e74bad88908a5e9f662f73b73356c5607e80c6869da4f8c82339526887f8411b368c1cc831af4fd4f77965353ad71176628b9b8f88be9fee235
|
7
|
+
data.tar.gz: 2949be7620780143fbcdbb04957dc70fdfcf63bb37bfb09b84d5cf1b69e7e367a29df3488eb258dc4827ed811d4bf69019633f85e3831ff8b38ae2cb582b78b6
|
data/Gemfile.lock
CHANGED
data/lib/settings.rb
CHANGED
data/lib/unotifier/version.rb
CHANGED
data/lib/unotifier.rb
CHANGED
@@ -68,7 +68,7 @@ module UNotifier
|
|
68
68
|
|
69
69
|
def self.notify(key, target, params = {})
|
70
70
|
user_settings = target.notification_settings[key]
|
71
|
-
user_settings ||=
|
71
|
+
user_settings ||= Settings::DEFAULT_URGENCY
|
72
72
|
locale_key = locale_key_for(key, params)
|
73
73
|
urgency = urgency_for(key, params)
|
74
74
|
|
@@ -97,6 +97,15 @@ module UNotifier
|
|
97
97
|
notify(key, target, params.merge(external_only: true))
|
98
98
|
end
|
99
99
|
|
100
|
+
def self.notification_settings_for(target)
|
101
|
+
user_settings = target.notification_settings
|
102
|
+
Settings
|
103
|
+
.keys_from(notifications_config)
|
104
|
+
.each_with_object({}) do |key, settings|
|
105
|
+
settings[key] = user_settings[key] || Settings::DEFAULT_URGENCY
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
100
109
|
private
|
101
110
|
|
102
111
|
def self.notify_onsite?(notification, user_settings)
|