commontator 6.0.0.pre.2 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/commontator/thread.rb +11 -9
- data/config/initializers/commontator.rb +1 -1
- data/lib/commontator/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72fc2d006727dfff3cf250d48273f122fb2932b6db8ebe9422e8ba624ad3290
|
4
|
+
data.tar.gz: 658d3fd4fae52f45de97e2e626dea6594b5739129dcbe79686b1d8bcb517446f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2542590cca9e1cc266fadfcb3b5783f675e12f116361c5f9ee1530a3f0c91ed845e60a52809286e6c3f625fa142729c4d7f19e6cda78f1af4f01e03782d89ad
|
7
|
+
data.tar.gz: d3021862824f68bd2a14d3fb13511e6958721949f8843c8ce264a219e44ea1c8ea7df2fb471787ab18b2e9070da4d69ef1501177a6b9ab7dfafb23e2e8e45276
|
@@ -55,7 +55,7 @@ class Commontator::Thread < ActiveRecord::Base
|
|
55
55
|
[ :i, :b ].include?(config.comment_reply_style) ? oc.where(parent_id: parent_id) : oc
|
56
56
|
end
|
57
57
|
|
58
|
-
def paginated_comments(page
|
58
|
+
def paginated_comments(page, parent_id, show_all)
|
59
59
|
cp = comments_with_parent_id(parent_id, show_all)
|
60
60
|
|
61
61
|
cp.paginate(page: page, per_page: config.comments_per_page[0])
|
@@ -90,10 +90,10 @@ class Commontator::Thread < ActiveRecord::Base
|
|
90
90
|
if [ :i, :b ].include? config.comment_reply_style
|
91
91
|
all_parent_ids = comments.map(&:id)
|
92
92
|
(config.comments_per_page[1..-1] + [ 0 ]).each_with_index do |per_page, index|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
filtered_comments(show_all).where(parent_id: all_parent_ids)
|
94
|
+
.group(:parent_id)
|
95
|
+
.count
|
96
|
+
.each do |parent_id, count|
|
97
97
|
count_by_parent_id[parent_id] = count
|
98
98
|
per_page_by_parent_id[parent_id] = per_page
|
99
99
|
end
|
@@ -103,10 +103,12 @@ class Commontator::Thread < ActiveRecord::Base
|
|
103
103
|
children = all_parent_ids.empty? ? [] : Commontator::Comment.find_by_sql(
|
104
104
|
all_parent_ids.map do |parent_id|
|
105
105
|
Commontator::Comment.select(Arel.star).from(
|
106
|
-
Arel::Nodes::
|
107
|
-
Arel::Nodes::
|
108
|
-
|
109
|
-
|
106
|
+
Arel::Nodes::TableAlias.new(
|
107
|
+
Arel::Nodes::Grouping.new(
|
108
|
+
Arel::Nodes::SqlLiteral.new(
|
109
|
+
ordered_comments(show_all).where(parent_id: parent_id).limit(per_page).to_sql
|
110
|
+
)
|
111
|
+
), :commontator_comments
|
110
112
|
)
|
111
113
|
).to_sql
|
112
114
|
end.reduce { |memo, sql| memo.nil? ? sql : "#{memo} UNION ALL #{sql}" }
|
@@ -234,7 +234,7 @@ Commontator.configure do |config|
|
|
234
234
|
# The array represents how many comments to load at each nesting level, with the
|
235
235
|
# first number corresponding to the current level, the second number to the next level, etc
|
236
236
|
# Note: large values WILL cause performance and memory issues with many nested comments
|
237
|
-
# The maximum number of comments loaded at once
|
237
|
+
# The maximum number of comments loaded at once for the default setting is:
|
238
238
|
# 20 + 20*5 + 20*5*2 == 320
|
239
239
|
# Default: [ 20, 5, 2 ]
|
240
240
|
config.comments_per_page = [ 20, 5, 2 ]
|
data/lib/commontator/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
COMMONTATOR_VERSION = '6.0.0
|
1
|
+
COMMONTATOR_VERSION = '6.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commontator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -246,9 +246,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
248
|
requirements:
|
249
|
-
- - "
|
249
|
+
- - ">="
|
250
250
|
- !ruby/object:Gem::Version
|
251
|
-
version:
|
251
|
+
version: '0'
|
252
252
|
requirements: []
|
253
253
|
rubygems_version: 3.0.4
|
254
254
|
signing_key:
|