commontator 6.2.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/helpers/commontator/link_renderer.rb +4 -0
- data/app/models/commontator/thread.rb +13 -3
- data/app/views/commontator/comments/_show.html.erb +1 -1
- data/app/views/commontator/subscriptions/_link.html.erb +1 -1
- data/app/views/commontator/threads/_show.html.erb +2 -2
- data/lib/commontator/acts_as_commontable.rb +1 -1
- data/lib/commontator/acts_as_commontator.rb +2 -2
- data/lib/commontator/controllers.rb +0 -4
- data/lib/commontator/engine.rb +6 -0
- data/lib/commontator/shared_helper.rb +3 -0
- data/lib/commontator/version.rb +1 -1
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4b52a669ee098261a37c5670b3d964f7f5be3628ee9036471240fde923f77ec
|
4
|
+
data.tar.gz: 95b55b14e06b86d302ac9b5d75107015fe3f6dd787ba77ff5b30112bfc53bcb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b14bdde0d9c9738efee797e609497d894f5e4d3bd77534f9fabc101b952e37d356b97579fe2ba2eaca6defea3d13bcc18276a20efd1c18ee92a7ff3296c8a6ac
|
7
|
+
data.tar.gz: e652e1739c6940111cae53b0a9fbc0c7fe3f8a4e251fd03f422c1ee501faad0382ffafffd331fa22ef66530b0a31fd820c444d582e3a1e7a139f25c2555bb6ad
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Commontator
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/commontator)
|
4
|
-
[](https://github.com/lml/commontator/actions?query=workflow:Tests)
|
5
5
|
[](https://codeclimate.com/github/lml/commontator)
|
6
6
|
[](https://codeclimate.com/github/lml/commontator)
|
7
7
|
|
8
|
-
Commontator is a Rails engine for comments. It is compatible with Rails 5+.
|
8
|
+
Commontator is a Rails engine for comments. It is compatible with Rails 5.2+.
|
9
9
|
Being an engine means it is fully functional as soon as you install and
|
10
10
|
configure the gem, providing models, views and controllers of its own.
|
11
11
|
At the same time, almost anything about it can be configured or customized to suit your needs.
|
@@ -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
|
|
@@ -36,7 +36,7 @@
|
|
36
36
|
<% is_deleted = comment.is_deleted? %>
|
37
37
|
<% del_string = is_deleted ? 'undelete' : 'delete' %>
|
38
38
|
<%= link_to t("commontator.comment.actions.#{del_string}"),
|
39
|
-
commontator.polymorphic_path([del_string, comment]),
|
39
|
+
commontator.polymorphic_path([del_string.to_sym, comment]),
|
40
40
|
data: is_deleted ? {} : { confirm: t('commontator.comment.actions.confirm_delete') },
|
41
41
|
method: :put,
|
42
42
|
id: "commontator-comment-#{comment.id}-#{del_string}",
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<% is_subscribed = !!thread.subscription_for(user) %>
|
8
8
|
<% sub_string = is_subscribed ? 'unsubscribe' : 'subscribe' %>
|
9
9
|
<%= link_to t("commontator.subscription.actions.#{sub_string}"),
|
10
|
-
commontator.polymorphic_path([sub_string, thread]),
|
10
|
+
commontator.polymorphic_path([sub_string.to_sym, thread]),
|
11
11
|
method: :put,
|
12
12
|
id: "commontator-thread-#{thread.id}-#{sub_string}",
|
13
13
|
class: sub_string,
|
@@ -54,7 +54,7 @@
|
|
54
54
|
<% end %>
|
55
55
|
|
56
56
|
<%= link_to t("commontator.thread.actions.#{close_string}"),
|
57
|
-
commontator.polymorphic_path([close_string, thread]),
|
57
|
+
commontator.polymorphic_path([close_string.to_sym, thread]),
|
58
58
|
data: is_closed ? {} :
|
59
59
|
{ confirm: t('commontator.thread.actions.confirm_close') },
|
60
60
|
method: :put,
|
@@ -110,5 +110,5 @@
|
|
110
110
|
</div>
|
111
111
|
|
112
112
|
<script type="text/javascript">
|
113
|
-
<%= render partial: 'commontator/threads/hide_show_links
|
113
|
+
<%= render partial: 'commontator/threads/hide_show_links', locals: { thread: thread } %>
|
114
114
|
</script>
|
@@ -17,7 +17,7 @@ module Commontator::ActsAsCommontable
|
|
17
17
|
cattr_accessor :commontable_config
|
18
18
|
self.commontable_config = Commontator::CommontableConfig.new(options)
|
19
19
|
|
20
|
-
has_one :commontator_thread, association_options.merge(
|
20
|
+
has_one :commontator_thread, **association_options.merge(
|
21
21
|
as: :commontable, class_name: 'Commontator::Thread'
|
22
22
|
)
|
23
23
|
|
@@ -16,10 +16,10 @@ module Commontator::ActsAsCommontator
|
|
16
16
|
cattr_accessor :commontator_config
|
17
17
|
self.commontator_config = Commontator::CommontatorConfig.new(options)
|
18
18
|
|
19
|
-
has_many :commontator_comments, association_options.merge(
|
19
|
+
has_many :commontator_comments, **association_options.merge(
|
20
20
|
as: :creator, class_name: 'Commontator::Comment'
|
21
21
|
)
|
22
|
-
has_many :commontator_subscriptions, association_options.merge(
|
22
|
+
has_many :commontator_subscriptions, **association_options.merge(
|
23
23
|
as: :subscriber, class_name: 'Commontator::Subscription'
|
24
24
|
)
|
25
25
|
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require_relative 'shared_helper'
|
2
2
|
|
3
3
|
module Commontator::Controllers
|
4
|
-
def self.included(base)
|
5
|
-
base.helper Commontator::SharedHelper
|
6
|
-
end
|
7
|
-
|
8
4
|
def commontator_set_thread_variables
|
9
5
|
return if @commontator_thread.nil? || !@commontator_thread.can_be_read_by?(@commontator_user)
|
10
6
|
|
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.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:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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: '
|
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
|
@@ -236,7 +250,7 @@ homepage: https://github.com/lml/commontator
|
|
236
250
|
licenses:
|
237
251
|
- MIT
|
238
252
|
metadata: {}
|
239
|
-
post_install_message:
|
253
|
+
post_install_message:
|
240
254
|
rdoc_options: []
|
241
255
|
require_paths:
|
242
256
|
- lib
|
@@ -251,8 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
265
|
- !ruby/object:Gem::Version
|
252
266
|
version: '0'
|
253
267
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
255
|
-
signing_key:
|
268
|
+
rubygems_version: 3.1.4
|
269
|
+
signing_key:
|
256
270
|
specification_version: 4
|
257
271
|
summary: Allows users to comment on any model in your application.
|
258
272
|
test_files: []
|