commontator 6.3.2 → 7.0.0

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
  SHA256:
3
- metadata.gz: 4be189fd8c44438a5fe1717c74bfe09067f16dbaaccda6daf159e70213e2c39a
4
- data.tar.gz: 6f62579a12c5b207ed9f879e3d473d654915c9fe1ac17dcc51ba0655502793c9
3
+ metadata.gz: e4b52a669ee098261a37c5670b3d964f7f5be3628ee9036471240fde923f77ec
4
+ data.tar.gz: 95b55b14e06b86d302ac9b5d75107015fe3f6dd787ba77ff5b30112bfc53bcb7
5
5
  SHA512:
6
- metadata.gz: b15a7623162ca1ff592e8eb3bd4e15e99d6514e744625686aff53a6cf523d4abf43bdbb070a6eafa8f09d1e992332288a8c053a5d2a11c676424f20c89d4a613
7
- data.tar.gz: e79a8df63ac01a4f837db59f4cb0dd23fec1a633d0045a02825a1562791f161d592f58a68b3aa23231cbe32e3ede2c6a8192a0de45af9186ee684da5b44c61f5
6
+ metadata.gz: b14bdde0d9c9738efee797e609497d894f5e4d3bd77534f9fabc101b952e37d356b97579fe2ba2eaca6defea3d13bcc18276a20efd1c18ee92a7ff3296c8a6ac
7
+ data.tar.gz: e652e1739c6940111cae53b0a9fbc0c7fe3f8a4e251fd03f422c1ee501faad0382ffafffd331fa22ef66530b0a31fd820c444d582e3a1e7a139f25c2555bb6ad
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
- [![Build Status](https://travis-ci.org/lml/commontator.svg?branch=master)](https://travis-ci.org/lml/commontator)
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
- ActiveRecord::Associations::Preloader.new.preload(
151
- nested_comments.flatten, :votes_for, ActsAsVotable::Vote.where(voter: user)
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
 
@@ -110,5 +110,5 @@
110
110
  </div>
111
111
 
112
112
  <script type="text/javascript">
113
- <%= render partial: 'commontator/threads/hide_show_links.js', locals: { thread: thread } %>
113
+ <%= render partial: 'commontator/threads/hide_show_links', locals: { thread: thread } %>
114
114
  </script>
@@ -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
@@ -1 +1 @@
1
- COMMONTATOR_VERSION = '6.3.2'
1
+ COMMONTATOR_VERSION = '7.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.3.2
4
+ version: 7.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: 2021-10-21 00:00:00.000000000 Z
11
+ date: 2022-01-17 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: '5.2'
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: '5.2'
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