libertree-model 0.9.15 → 0.9.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libertree/model/pool.rb +20 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d084f6691620280affdb0defc6e7ab1d2f7c0b3a7966add5adee31907afb088
|
4
|
+
data.tar.gz: 7a521d8ba93a593d3d07b8fcf91489b45a6df057d7a557777d72ced929fdd9d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dc52396d815bd7e0b76d3212bc30151ded903bb1a285b2858ed1482857191eaf2cea655604c39cdde58cb07c2731f9c8a425e412d67c262c726c438c142e247
|
7
|
+
data.tar.gz: 3c1d4b88e5962951d6e438af844527c5ba5ffb2f1f86abad523d33f139642d6c7f8da158fea829021e3919e38e10e5ac03fa01a3aed9f3e0e573c017559d85f3
|
data/lib/libertree/model/pool.rb
CHANGED
@@ -76,21 +76,29 @@ module Libertree
|
|
76
76
|
def posts( opts = {} )
|
77
77
|
limit = opts.fetch(:limit, 30)
|
78
78
|
time = Time.at( opts.fetch(:time, Time.now.to_f) ).strftime("%Y-%m-%d %H:%M:%S.%6N%z")
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
79
|
+
if opts[:newer]
|
80
|
+
time_clause = proc { time_created > time }
|
81
|
+
else
|
82
|
+
time_clause = proc { time_created < time }
|
83
|
+
end
|
84
|
+
|
85
|
+
order_by_updated = opts.fetch(:order_by_updated, false)
|
86
|
+
if order_by_updated
|
87
|
+
order = Sequel.lit("GREATEST(posts.time_commented, posts.time_updated)")
|
88
|
+
else
|
89
|
+
order = Sequel.qualify(:posts, :id)
|
90
|
+
end
|
91
|
+
|
92
|
+
res = Post.qualify
|
93
|
+
.join(:pools_posts, post_id: :id)
|
94
|
+
.where(&time_clause)
|
95
|
+
.where(pool_id: self.id)
|
96
|
+
.reverse_order(order)
|
97
|
+
.limit(limit)
|
91
98
|
|
92
99
|
# optionally restrict to Internet visible posts
|
93
100
|
res = res.where(visibility: 'internet') if opts[:public]
|
101
|
+
|
94
102
|
res
|
95
103
|
end
|
96
104
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libertree-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pistos
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-07-
|
12
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-oembed
|