notifly 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eed5d09169b00e015b843f966332e3e558618df
|
4
|
+
data.tar.gz: 82e251a76068372513597dc289e1c3388f2599dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a6436ea150dfa3e28b65a3bd9d4150c722abd4499ff22d47bd86e2c850d2cefdbb7ef4f63afe61768d978fe28499f1c6203c8c565d9a5a4b608b7215cc52d29
|
7
|
+
data.tar.gz: 87d238c6a8c05ab02d6c57bcd03df527e297197a33c9c85312fe753369a281e356f0fbe01d16b45225e57b73052d4965f5377e06f1ecfec8b56f4d687e071200
|
@@ -32,7 +32,7 @@ module Notifly
|
|
32
32
|
|
33
33
|
private
|
34
34
|
def scoped_notifications
|
35
|
-
current_user_notifications.send(scope_param, than: params[:reference_notification_id])
|
35
|
+
current_user_notifications.send(scope_param, than: params[:reference_notification_id]).limited
|
36
36
|
end
|
37
37
|
|
38
38
|
def scope_param
|
@@ -4,7 +4,7 @@ module Notifly
|
|
4
4
|
belongs_to :sender, polymorphic: true
|
5
5
|
belongs_to :receiver, polymorphic: true
|
6
6
|
|
7
|
-
before_validation :
|
7
|
+
before_validation :set_defaults
|
8
8
|
|
9
9
|
scope :all_from, -> (receiver) { where(receiver: receiver) }
|
10
10
|
scope :unseen, -> { where(seen: false) }
|
@@ -12,7 +12,7 @@ module Notifly
|
|
12
12
|
scope :limited, -> { limit(Notifly.per_page) }
|
13
13
|
scope :ordered, -> { order('created_at DESC') }
|
14
14
|
scope :newer, ->(than: nil) do
|
15
|
-
return ordered
|
15
|
+
return ordered if than.blank?
|
16
16
|
|
17
17
|
reference = find(than)
|
18
18
|
ordered.where('created_at > ?', reference.created_at).where.not(id: reference)
|
@@ -22,8 +22,7 @@ module Notifly
|
|
22
22
|
|
23
23
|
ordered.
|
24
24
|
where('created_at < ?', reference.created_at).
|
25
|
-
where.not(id: reference)
|
26
|
-
limited
|
25
|
+
where.not(id: reference)
|
27
26
|
end
|
28
27
|
scope :between, ->(first, last) do
|
29
28
|
notifications = where(id: [first, last])
|
@@ -32,15 +31,9 @@ module Notifly
|
|
32
31
|
|
33
32
|
validates :receiver, :template, :mail, :kind, presence: true
|
34
33
|
|
35
|
-
|
36
|
-
YAML.load(read_attribute(:data))
|
37
|
-
end
|
34
|
+
serialize :data, JSON
|
38
35
|
|
39
36
|
private
|
40
|
-
def convert_data
|
41
|
-
self.data = read_attribute(:data).to_json
|
42
|
-
end
|
43
|
-
|
44
37
|
def set_defaults
|
45
38
|
self.mail ||= :never
|
46
39
|
self.kind ||= :notification
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Passalini
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|