commontator 6.3.2 → 7.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/models/commontator/thread.rb +13 -3
- data/app/views/commontator/threads/_show.html.erb +1 -1
- data/lib/commontator/engine.rb +6 -0
- data/lib/commontator/version.rb +1 -1
- data/lib/tasks/commontator_tasks.rake +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d32487b625a32370eb044420a54c875d776ef2ba3ed35a9c7f33b913deb36289
|
4
|
+
data.tar.gz: 473d9334f809f2105641bee58e19d2da534191afedd316dfbf246e1e292c8178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5255656ac1977905a47761d286864ba62c83150d8a8210c3aeb7168c6851a98a7134f952ee2f47d79bf154c8217b7e665fb42701c220d13e54fea0eece735d94
|
7
|
+
data.tar.gz: f93cc702c24511578aec365d38c11b0d6d5177962a0acb05a76b248b4143247ce4a61d216f40c80bdbbbfb04967d1f1b43d54e5bdcee873da52dfb133dafc4d9
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Commontator
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/commontator.svg)](https://badge.fury.io/rb/commontator)
|
4
|
-
[![
|
4
|
+
[![Tests](https://github.com/lml/commontator/workflows/Tests/badge.svg)](https://github.com/lml/commontator/actions?query=workflow:Tests)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/lml/commontator/badges/gpa.svg)](https://codeclimate.com/github/lml/commontator)
|
6
6
|
[![Code Coverage](https://codeclimate.com/github/lml/commontator/badges/coverage.svg)](https://codeclimate.com/github/lml/commontator)
|
7
7
|
|
@@ -8,6 +8,8 @@ class Commontator::Thread < ActiveRecord::Base
|
|
8
8
|
validates :commontable, presence: true, unless: :is_closed?
|
9
9
|
validates :commontable_id, uniqueness: { scope: :commontable_type, allow_nil: true }
|
10
10
|
|
11
|
+
RAILS_7_PRELOADER = Rails::VERSION::MAJOR >= 7
|
12
|
+
|
11
13
|
def config
|
12
14
|
@config ||= commontable.try(:commontable_config) || Commontator
|
13
15
|
end
|
@@ -147,9 +149,17 @@ class Commontator::Thread < ActiveRecord::Base
|
|
147
149
|
).tap do |nested_comments|
|
148
150
|
next unless is_votable?
|
149
151
|
|
150
|
-
|
151
|
-
|
152
|
-
|
152
|
+
if RAILS_7_PRELOADER
|
153
|
+
ActiveRecord::Associations::Preloader.new(
|
154
|
+
records: nested_comments.flatten,
|
155
|
+
associations: :votes_for,
|
156
|
+
scope: ActsAsVotable::Vote.where(voter: user)
|
157
|
+
).call
|
158
|
+
else
|
159
|
+
ActiveRecord::Associations::Preloader.new.preload(
|
160
|
+
nested_comments.flatten, :votes_for, ActsAsVotable::Vote.where(voter: user)
|
161
|
+
)
|
162
|
+
end
|
153
163
|
end
|
154
164
|
end
|
155
165
|
|
data/lib/commontator/engine.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require 'commontator'
|
2
|
+
require 'sprockets/railtie'
|
2
3
|
|
3
4
|
class Commontator::Engine < ::Rails::Engine
|
4
5
|
isolate_namespace Commontator
|
5
6
|
|
7
|
+
# Files in installed gems don't change during development,
|
8
|
+
# but still cause issues in Rails 7 if autoloaded in an initializer
|
9
|
+
# To fix this, make sure they are autoloaded only once
|
10
|
+
config.autoload_once_paths = config.autoload_paths + config.eager_load_paths
|
11
|
+
|
6
12
|
config.assets.precompile += [ 'commontator/*.png' ]
|
7
13
|
end
|
data/lib/commontator/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
COMMONTATOR_VERSION = '
|
1
|
+
COMMONTATOR_VERSION = '7.0.1'
|
@@ -7,7 +7,7 @@ namespace :commontator do
|
|
7
7
|
desc "Copy initializers from commontator to application"
|
8
8
|
task :initializers do
|
9
9
|
Dir.glob(File.expand_path('../../config/initializers/*.rb', __dir__)) do |file|
|
10
|
-
if File.
|
10
|
+
if File.exist?(File.expand_path(File.basename(file), 'config/initializers'))
|
11
11
|
print "NOTE: Initializer #{File.basename(file)} from commontator has been skipped. Initializer with the same name already exists.\n"
|
12
12
|
else
|
13
13
|
cp file, 'config/initializers', verbose: false
|
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:
|
4
|
+
version: 7.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sprockets-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: will_paginate
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
265
|
- !ruby/object:Gem::Version
|
252
266
|
version: '0'
|
253
267
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
268
|
+
rubygems_version: 3.4.10
|
255
269
|
signing_key:
|
256
270
|
specification_version: 4
|
257
271
|
summary: Allows users to comment on any model in your application.
|