notify_user 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/notify_user/base_notification.rb +18 -17
- data/lib/notify_user/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc991c9547c3c9b6a595ebee3bb5a48284f620d2
|
4
|
+
data.tar.gz: 923ed73f2a0d2be1fc57a35b6ab5c6c0f0f59562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ef3f9889f3f3524633eca6d9d8dc70e09bd530b444a4978409b2abe6e4154437c8440ce6e8b84b9e13468ac4a68b9335007a1bf9397adfb28f7033a2cc621ce
|
7
|
+
data.tar.gz: c0969fcd052e22151f9ec4bf17b6ce1d9c45779d3318d4954f1e0db91733bac9c1abbdd0e4b62f8ed8101e22b7c3194a4dce333e198bc8aead830727cf514a24
|
@@ -77,18 +77,19 @@ module NotifyUser
|
|
77
77
|
def message
|
78
78
|
string = ActionView::Base.new(
|
79
79
|
Rails.configuration.paths["app/views"]).render(
|
80
|
-
:template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
|
81
|
-
:locals => { :params => self.params}
|
82
|
-
|
80
|
+
:template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
|
81
|
+
:locals => { :params => self.params})
|
82
|
+
|
83
|
+
return ::CGI.unescapeHTML("#{string}")
|
83
84
|
end
|
84
85
|
|
85
86
|
def mobile_message(length=115)
|
86
87
|
string = truncate(ActionView::Base.new(
|
87
88
|
Rails.configuration.paths["app/views"]).render(
|
88
|
-
:template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
|
89
|
-
:locals => { :params => self.params}
|
89
|
+
:template => self.class.views[:mobile_sdk][:template_path].call(self), :formats => [:html],
|
90
|
+
:locals => { :params => self.params}), :length => length)
|
90
91
|
|
91
|
-
return ::CGI.unescapeHTML("#{string}")
|
92
|
+
return ::CGI.unescapeHTML("#{string}")
|
92
93
|
end
|
93
94
|
|
94
95
|
## Public Interface
|
@@ -175,7 +176,7 @@ module NotifyUser
|
|
175
176
|
# if aggregation is false bypass aggregation completely
|
176
177
|
self.channels.each do |channel_name, options|
|
177
178
|
if(options[:aggregate_per] == false)
|
178
|
-
self.class.delay.deliver_notification_channel(self.id, channel_name)
|
179
|
+
self.class.delay.deliver_notification_channel(self.id, channel_name)
|
179
180
|
else
|
180
181
|
# only notifies channels if no pending aggreagte notifications
|
181
182
|
if not aggregation_pending?
|
@@ -186,7 +187,7 @@ module NotifyUser
|
|
186
187
|
end
|
187
188
|
end
|
188
189
|
|
189
|
-
# Sends immediately and without aggregation
|
190
|
+
# Sends immediately and without aggregation
|
190
191
|
def deliver!
|
191
192
|
if pending_no_aggregation? and not user_has_unsubscribed?
|
192
193
|
self.mark_as_sent!
|
@@ -242,7 +243,7 @@ module NotifyUser
|
|
242
243
|
|
243
244
|
# Find any pending notifications with the same type and target, which can all be sent in one message.
|
244
245
|
notifications = self.pending_aggregation_with(notification)
|
245
|
-
|
246
|
+
|
246
247
|
notifications.map(&:mark_as_sent)
|
247
248
|
notifications.map(&:save)
|
248
249
|
|
@@ -257,21 +258,21 @@ module NotifyUser
|
|
257
258
|
end
|
258
259
|
|
259
260
|
private
|
260
|
-
|
261
|
+
|
261
262
|
def unsubscribed_validation
|
262
|
-
errors.add(:target, (" has unsubscribed from this type")) if user_has_unsubscribed?
|
263
|
+
errors.add(:target, (" has unsubscribed from this type")) if user_has_unsubscribed?
|
263
264
|
end
|
264
265
|
|
265
266
|
def user_has_unsubscribed?
|
266
|
-
#return true if user has unsubscribed
|
267
|
-
return true unless NotifyUser::Unsubscribe.has_unsubscribed_from(self.target, self.type).empty?
|
267
|
+
#return true if user has unsubscribed
|
268
|
+
return true unless NotifyUser::Unsubscribe.has_unsubscribed_from(self.target, self.type).empty?
|
268
269
|
|
269
|
-
return false
|
270
|
+
return false
|
270
271
|
end
|
271
|
-
|
272
|
+
|
272
273
|
def self.unsubscribed_from_channel?(user, type)
|
273
|
-
#return true if user has unsubscribed
|
274
|
-
return !NotifyUser::Unsubscribe.has_unsubscribed_from(user, type).empty?
|
274
|
+
#return true if user has unsubscribed
|
275
|
+
return !NotifyUser::Unsubscribe.has_unsubscribed_from(user, type).empty?
|
275
276
|
end
|
276
277
|
|
277
278
|
|
data/lib/notify_user/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notify_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Spacek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|