thredded 0.16.9 → 0.16.10
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/concerns/thredded/post_common.rb +1 -1
- data/app/models/thredded/messageboard.rb +1 -1
- data/app/models/thredded/messageboard_group.rb +1 -1
- data/app/views/layouts/thredded/application.html.erb +2 -1
- data/app/views/thredded/shared/_page.html.erb +2 -2
- data/config/locales/de.yml +3 -3
- data/config/locales/en.yml +2 -2
- data/config/locales/es.yml +2 -2
- data/config/locales/fr.yml +2 -2
- data/config/locales/it.yml +2 -2
- data/config/locales/pl.yml +2 -2
- data/config/locales/pt-BR.yml +3 -3
- data/config/locales/zh-CN.yml +2 -2
- data/db/upgrade_migrations/20170125033319_upgrade_v0_9_to_v0_10.rb +22 -2
- data/lib/thredded.rb +6 -0
- data/lib/thredded/collection_to_strings_with_cache_renderer.rb +11 -1
- data/lib/thredded/database_seeder.rb +1 -1
- data/lib/thredded/version.rb +1 -1
- metadata +7 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b0d8ea36cff88b87fc05f44d4419af0872e6f2c6747fc316df5b010d1affd3
|
4
|
+
data.tar.gz: 5f82a2fdc6c287cd85cb3dd3a5ef12631e5227dfbef4ab2d68c7495c990bf523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec6c4e0b3ec14274519dcff925d6f10c3de0721de4dd074fd44ba193e682e178d1fabe3253e026bdc6cbdf53d13933675f39dbe61e308a8edb5af540930ade5c
|
7
|
+
data.tar.gz: befd728ca48d0a7c9313850fd1297f1afe9a1f52e73b960ad1b35b044484f131f0c2d9e7713cbc62dc453b45ba4888ec6a19872424071ddc67f83be03715fa83
|
data/README.md
CHANGED
@@ -95,7 +95,7 @@ Then, see the rest of this Readme for more information about using and customizi
|
|
95
95
|
Add the gem to your Gemfile:
|
96
96
|
|
97
97
|
```ruby
|
98
|
-
gem 'thredded', '~> 0.16.
|
98
|
+
gem 'thredded', '~> 0.16.10'
|
99
99
|
```
|
100
100
|
|
101
101
|
Add the Thredded [initializer] to your parent app by running the install generator.
|
@@ -23,7 +23,7 @@ module Thredded
|
|
23
23
|
result = all
|
24
24
|
ActiveRecord::Associations::Preloader.new.preload(
|
25
25
|
result.map(&:postable), :first_post,
|
26
|
-
|
26
|
+
unscoped.where(<<~SQL.delete("\n"))
|
27
27
|
#{posts_table_name}.created_at = (
|
28
28
|
SELECT MAX(p2.created_at) from #{posts_table_name} p2 WHERE p2.postable_id = #{posts_table_name}.postable_id)
|
29
29
|
SQL
|
@@ -24,7 +24,7 @@ module Thredded
|
|
24
24
|
validates :name, uniqueness: true, length: { within: Thredded.messageboard_name_length_range }, presence: true
|
25
25
|
validates :topics_count, numericality: true
|
26
26
|
validates :position, presence: true, on: :update
|
27
|
-
before_save :ensure_position
|
27
|
+
before_save :ensure_position
|
28
28
|
|
29
29
|
def ensure_position
|
30
30
|
self.position ||= (created_at || Time.zone.now).to_i
|
@@ -10,7 +10,7 @@ module Thredded
|
|
10
10
|
scope :ordered, -> { order(position: :asc, id: :asc) }
|
11
11
|
validates :name, presence: true, uniqueness: true
|
12
12
|
validates :position, presence: true, on: :update
|
13
|
-
before_save :ensure_position
|
13
|
+
before_save :ensure_position
|
14
14
|
|
15
15
|
def ensure_position
|
16
16
|
self.position ||= Time.zone.now.to_i
|
@@ -5,10 +5,11 @@
|
|
5
5
|
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
|
6
6
|
<%= stylesheet_link_tag 'thredded', 'data-turbolinks-track': 'reload' %>
|
7
7
|
<%= csrf_meta_tag %>
|
8
|
+
<%= csp_meta_tag if Thredded.rails_supports_csp_nonce? %>
|
8
9
|
<%= javascript_include_tag 'thredded',
|
9
10
|
async: !Rails.application.config.assets.debug,
|
10
11
|
defer: true,
|
11
|
-
'data-turbolinks-track': 'reload'%>
|
12
|
+
'data-turbolinks-track': 'reload' %>
|
12
13
|
<%== Gravatar.prefetch_dns %>
|
13
14
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
14
15
|
</head>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
<%# If thredded JS is loaded via an [async] script, the JS may
|
9
9
|
run before or after DOMContentLoaded. Expose a flag to Thredded
|
10
10
|
so it can initialize correctly. %>
|
11
|
-
|
11
|
+
<%= javascript_tag 'data-turbolinks-eval': 'false', **(Thredded.rails_supports_csp_nonce? ? {nonce: true} : {}) do %>
|
12
12
|
document.addEventListener('DOMContentLoaded', function() {
|
13
13
|
(window.Thredded = window.Thredded || {}).DOMContentLoadedFired = true;
|
14
14
|
});
|
15
|
-
|
15
|
+
<% end %>
|
data/config/locales/de.yml
CHANGED
@@ -259,13 +259,13 @@ de:
|
|
259
259
|
last_active_html: Zuletzt aktiv %{time_ago}
|
260
260
|
posted_in_topic_html: Hochgeladen in %{topic_link}
|
261
261
|
posts_count:
|
262
|
-
one:
|
263
|
-
other: "%{count}
|
262
|
+
one: "%{count}-mal hochgeladen"
|
263
|
+
other: "%{count}-mal hochgeladen"
|
264
264
|
recent_activity: :thredded.recent_activity
|
265
265
|
send_private_message: Private Nachricht senden
|
266
266
|
started_topic_html: "%{topic_link} gestartet"
|
267
267
|
started_topics_count:
|
268
|
-
one:
|
268
|
+
one: "%{count} Diskussion gestartet"
|
269
269
|
other: "%{count} Diskussionen gestartet"
|
270
270
|
user_posted_in_topic_html: "%{user_link} hochgeladen in %{topic_link}"
|
271
271
|
user_since_html: Nutzer seit %{time_ago}
|
data/config/locales/en.yml
CHANGED
@@ -255,13 +255,13 @@ en:
|
|
255
255
|
last_active_html: Last active %{time_ago}
|
256
256
|
posted_in_topic_html: Posted in %{topic_link}
|
257
257
|
posts_count:
|
258
|
-
one: Posted
|
258
|
+
one: Posted %{count} time
|
259
259
|
other: Posted %{count} times
|
260
260
|
recent_activity: :thredded.recent_activity
|
261
261
|
send_private_message: Send private message
|
262
262
|
started_topic_html: Started %{topic_link}
|
263
263
|
started_topics_count:
|
264
|
-
one: Started
|
264
|
+
one: Started %{count} topic
|
265
265
|
other: Started %{count} topics
|
266
266
|
user_posted_in_topic_html: "%{user_link} posted in %{topic_link}"
|
267
267
|
user_since_html: User since %{time_ago}
|
data/config/locales/es.yml
CHANGED
@@ -259,13 +259,13 @@ es:
|
|
259
259
|
last_active_html: Última vez activo hace %{time_ago}
|
260
260
|
posted_in_topic_html: Escribió en %{topic_link}
|
261
261
|
posts_count:
|
262
|
-
one: Ha escrito
|
262
|
+
one: Ha escrito %{count} vez
|
263
263
|
other: Ha escrito %{count} veces
|
264
264
|
recent_activity: :thredded.recent_activity
|
265
265
|
send_private_message: Enviar mensaje privado
|
266
266
|
started_topic_html: Empezó %{topic_link}
|
267
267
|
started_topics_count:
|
268
|
-
one: Ha empezado
|
268
|
+
one: Ha empezado %{count} tema
|
269
269
|
other: Ha empezado %{count} temas
|
270
270
|
user_posted_in_topic_html: "%{user_link} escribió en %{topic_link}"
|
271
271
|
user_since_html: Usuario desde %{time_ago}
|
data/config/locales/fr.yml
CHANGED
@@ -257,13 +257,13 @@ fr:
|
|
257
257
|
last_active_html: 'Actif pour la dernière fois : %{time_ago}'
|
258
258
|
posted_in_topic_html: Commenté dans %{topic_link}
|
259
259
|
posts_count:
|
260
|
-
one: Commenté
|
260
|
+
one: Commenté %{count} fois
|
261
261
|
other: Commenté %{count} fois
|
262
262
|
recent_activity: :thredded.recent_activity
|
263
263
|
send_private_message: Envoyer un message privé
|
264
264
|
started_topic_html: Démarré %{topic_link}
|
265
265
|
started_topics_count:
|
266
|
-
one: Démarré
|
266
|
+
one: Démarré %{count} sujet
|
267
267
|
other: Démarré %{count} sujets
|
268
268
|
user_posted_in_topic_html: "%{user_link} a commenté dans %{topic_link}"
|
269
269
|
user_since_html: Utilisateur depuis %{time_ago}
|
data/config/locales/it.yml
CHANGED
@@ -259,13 +259,13 @@ it:
|
|
259
259
|
last_active_html: Ultima attività %{time_ago}
|
260
260
|
posted_in_topic_html: Ha scritto in %{topic_link}
|
261
261
|
posts_count:
|
262
|
-
one: Ha commentato
|
262
|
+
one: Ha commentato %{count} volta
|
263
263
|
other: Ha commentato %{count} volte
|
264
264
|
recent_activity: :thredded.recent_activity
|
265
265
|
send_private_message: Invia un messaggio privato
|
266
266
|
started_topic_html: Ha iniziato %{topic_link}
|
267
267
|
started_topics_count:
|
268
|
-
one: Ha iniziato
|
268
|
+
one: Ha iniziato %{count} discussione
|
269
269
|
other: Ha iniziato %{count} discussioni
|
270
270
|
user_posted_in_topic_html: "%{user_link} ha commentato in %{topic_link}"
|
271
271
|
user_since_html: Utente da %{time_ago}
|
data/config/locales/pl.yml
CHANGED
@@ -257,7 +257,7 @@ pl:
|
|
257
257
|
posts_count:
|
258
258
|
few: Napisał %{count} postów
|
259
259
|
many: Napisał %{count} postów
|
260
|
-
one: Napisał
|
260
|
+
one: Napisał %{count} post
|
261
261
|
other: Napisał %{count} postów
|
262
262
|
recent_activity: :thredded.recent_activity
|
263
263
|
send_private_message: Wyślij Wiadomość Prywatną
|
@@ -265,7 +265,7 @@ pl:
|
|
265
265
|
started_topics_count:
|
266
266
|
few: Rozpoczął %{count} tematy
|
267
267
|
many: Rozpoczął %{count} tematów
|
268
|
-
one: Rozpoczął
|
268
|
+
one: Rozpoczął %{count} temat
|
269
269
|
other: Rozpoczął %{count} tematów
|
270
270
|
user_posted_in_topic_html: "%{user_link} napisał w %{topic_link}"
|
271
271
|
user_since_html: Zarejestrowany od %{time_ago}
|
data/config/locales/pt-BR.yml
CHANGED
@@ -260,14 +260,14 @@ pt-BR:
|
|
260
260
|
last_active_html: Última atividade %{time_ago}
|
261
261
|
posted_in_topic_html: Postou em %{topic_link}
|
262
262
|
posts_count:
|
263
|
-
one: Postado
|
263
|
+
one: Postado %{count} vez
|
264
264
|
other: Postado %{count} vezes
|
265
265
|
recent_activity: :thredded.recent_activity
|
266
266
|
send_private_message: Enviar mensagem privada
|
267
267
|
started_topic_html: Começou %{topic_link}
|
268
268
|
started_topics_count:
|
269
|
-
one: Começou
|
270
|
-
other:
|
269
|
+
one: Começou %{count} tópico
|
270
|
+
other: Começou %{count} tópicos
|
271
271
|
user_posted_in_topic_html: "%{user_link} postou em %{topic_link}"
|
272
272
|
user_since_html: Usuário desde %{time_ago}
|
273
273
|
user_started_topic_html: "%{user_link} começou %{topic_link}"
|
data/config/locales/zh-CN.yml
CHANGED
@@ -248,13 +248,13 @@ zh-CN:
|
|
248
248
|
last_active_html: 最后活跃%{time_ago}
|
249
249
|
posted_in_topic_html: 在%{topic_link}中回复到:
|
250
250
|
posts_count:
|
251
|
-
one:
|
251
|
+
one: "%{count} 个回复"
|
252
252
|
other: "%{count} 个回复"
|
253
253
|
recent_activity: :thredded.recent_activity
|
254
254
|
send_private_message: 发送私人讯息
|
255
255
|
started_topic_html: 发布帖子 %{topic_link}
|
256
256
|
started_topics_count:
|
257
|
-
one:
|
257
|
+
one: 发布 %{count} 个帖子
|
258
258
|
other: 发布 %{count} 个帖子
|
259
259
|
user_posted_in_topic_html: "%{user_link} 回复在 %{topic_link}"
|
260
260
|
user_since_html: 用户自%{time_ago}
|
@@ -4,10 +4,10 @@ require 'thredded/base_migration'
|
|
4
4
|
|
5
5
|
class UpgradeV09ToV010 < Thredded::BaseMigration
|
6
6
|
def up
|
7
|
-
|
7
|
+
remove_foreign_key_if_present :thredded_messageboard_users, :thredded_messageboards
|
8
8
|
add_foreign_key :thredded_messageboard_users, :thredded_messageboards,
|
9
9
|
column: :thredded_messageboard_id, on_delete: :cascade
|
10
|
-
|
10
|
+
remove_foreign_key_if_present :thredded_messageboard_users, :thredded_user_details
|
11
11
|
add_foreign_key :thredded_messageboard_users, :thredded_user_details,
|
12
12
|
column: :thredded_user_detail_id, on_delete: :cascade
|
13
13
|
|
@@ -33,4 +33,24 @@ class UpgradeV09ToV010 < Thredded::BaseMigration
|
|
33
33
|
remove_foreign_key :thredded_messageboard_users, :thredded_messageboards
|
34
34
|
add_foreign_key :thredded_messageboard_users, :thredded_messageboards
|
35
35
|
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def remove_foreign_key_if_present(table, column)
|
40
|
+
# We had an inconsistency between v0.9 initial and upgrade migrations, as only one of them added these foreign keys.
|
41
|
+
# Here we remove the foreign keys before adding new ones.
|
42
|
+
if respond_to?(:foreign_key_exists?)
|
43
|
+
if foreign_key_exists?(table, column)
|
44
|
+
remove_foreign_key table, column
|
45
|
+
else
|
46
|
+
say "Not removing foreign key for (#{table}, #{column}) because there isn't one"
|
47
|
+
end
|
48
|
+
else
|
49
|
+
begin
|
50
|
+
remove_foreign_key table, column
|
51
|
+
rescue StandardError
|
52
|
+
say "Not removing foreign key for (#{table}, #{column}) because there isn't one"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
36
56
|
end
|
data/lib/thredded.rb
CHANGED
@@ -250,6 +250,12 @@ module Thredded # rubocop:disable Metrics/ModuleLength
|
|
250
250
|
@rails_gte_51 = (Rails.gem_version >= Gem::Version.new('5.1.0')) if @rails_gte_51.nil?
|
251
251
|
@rails_gte_51
|
252
252
|
end
|
253
|
+
|
254
|
+
# @api private
|
255
|
+
def rails_supports_csp_nonce?
|
256
|
+
@rails_supports_csp_nonce = (Rails.gem_version >= Gem::Version.new('5.2.0')) if @rails_supports_csp_nonce.nil?
|
257
|
+
@rails_supports_csp_nonce
|
258
|
+
end
|
253
259
|
end
|
254
260
|
|
255
261
|
self.user_name_column = :name
|
@@ -83,7 +83,17 @@ module Thredded
|
|
83
83
|
# @return [Array<String>]
|
84
84
|
def render_partials_serial(view_context, collection, opts)
|
85
85
|
partial_renderer = ActionView::PartialRenderer.new(@lookup_context)
|
86
|
-
collection.map { |object| partial_renderer
|
86
|
+
collection.map { |object| render_partial(partial_renderer, view_context, opts.merge(object: object)) }
|
87
|
+
end
|
88
|
+
|
89
|
+
if Rails::VERSION::MAJOR >= 6
|
90
|
+
def render_partial(partial_renderer, view_context, opts)
|
91
|
+
partial_renderer.render(view_context, opts, nil).body
|
92
|
+
end
|
93
|
+
else
|
94
|
+
def render_partial(partial_renderer, view_context, opts)
|
95
|
+
partial_renderer.render(view_context, opts, nil)
|
96
|
+
end
|
87
97
|
end
|
88
98
|
end
|
89
99
|
end
|
data/lib/thredded/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thredded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Oliveira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-03-
|
12
|
+
date: 2019-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_record_union
|
@@ -340,19 +340,19 @@ dependencies:
|
|
340
340
|
- !ruby/object:Gem::Version
|
341
341
|
version: '0'
|
342
342
|
- !ruby/object:Gem::Dependency
|
343
|
-
name:
|
343
|
+
name: factory_bot
|
344
344
|
requirement: !ruby/object:Gem::Requirement
|
345
345
|
requirements:
|
346
346
|
- - ">="
|
347
347
|
- !ruby/object:Gem::Version
|
348
|
-
version: 5.0.
|
348
|
+
version: 5.0.2
|
349
349
|
type: :development
|
350
350
|
prerelease: false
|
351
351
|
version_requirements: !ruby/object:Gem::Requirement
|
352
352
|
requirements:
|
353
353
|
- - ">="
|
354
354
|
- !ruby/object:Gem::Version
|
355
|
-
version: 5.0.
|
355
|
+
version: 5.0.2
|
356
356
|
- !ruby/object:Gem::Dependency
|
357
357
|
name: faker
|
358
358
|
requirement: !ruby/object:Gem::Requirement
|
@@ -395,34 +395,6 @@ dependencies:
|
|
395
395
|
- - ">="
|
396
396
|
- !ruby/object:Gem::Version
|
397
397
|
version: 3.5.0
|
398
|
-
- !ruby/object:Gem::Dependency
|
399
|
-
name: rubocop
|
400
|
-
requirement: !ruby/object:Gem::Requirement
|
401
|
-
requirements:
|
402
|
-
- - '='
|
403
|
-
- !ruby/object:Gem::Version
|
404
|
-
version: 0.58.2
|
405
|
-
type: :development
|
406
|
-
prerelease: false
|
407
|
-
version_requirements: !ruby/object:Gem::Requirement
|
408
|
-
requirements:
|
409
|
-
- - '='
|
410
|
-
- !ruby/object:Gem::Version
|
411
|
-
version: 0.58.2
|
412
|
-
- !ruby/object:Gem::Dependency
|
413
|
-
name: rubocop-rspec
|
414
|
-
requirement: !ruby/object:Gem::Requirement
|
415
|
-
requirements:
|
416
|
-
- - '='
|
417
|
-
- !ruby/object:Gem::Version
|
418
|
-
version: 1.28.0
|
419
|
-
type: :development
|
420
|
-
prerelease: false
|
421
|
-
version_requirements: !ruby/object:Gem::Requirement
|
422
|
-
requirements:
|
423
|
-
- - '='
|
424
|
-
- !ruby/object:Gem::Version
|
425
|
-
version: 1.28.0
|
426
398
|
- !ruby/object:Gem::Dependency
|
427
399
|
name: simplecov
|
428
400
|
requirement: !ruby/object:Gem::Requirement
|
@@ -465,20 +437,6 @@ dependencies:
|
|
465
437
|
- - ">="
|
466
438
|
- !ruby/object:Gem::Version
|
467
439
|
version: '0'
|
468
|
-
- !ruby/object:Gem::Dependency
|
469
|
-
name: i18n-tasks
|
470
|
-
requirement: !ruby/object:Gem::Requirement
|
471
|
-
requirements:
|
472
|
-
- - ">="
|
473
|
-
- !ruby/object:Gem::Version
|
474
|
-
version: 0.9.18
|
475
|
-
type: :development
|
476
|
-
prerelease: false
|
477
|
-
version_requirements: !ruby/object:Gem::Requirement
|
478
|
-
requirements:
|
479
|
-
- - ">="
|
480
|
-
- !ruby/object:Gem::Version
|
481
|
-
version: 0.9.18
|
482
440
|
- !ruby/object:Gem::Dependency
|
483
441
|
name: kaminari-i18n
|
484
442
|
requirement: !ruby/object:Gem::Requirement
|
@@ -555,28 +513,14 @@ dependencies:
|
|
555
513
|
requirements:
|
556
514
|
- - ">="
|
557
515
|
- !ruby/object:Gem::Version
|
558
|
-
version: 2.1
|
516
|
+
version: 2.2.1
|
559
517
|
type: :development
|
560
518
|
prerelease: false
|
561
519
|
version_requirements: !ruby/object:Gem::Requirement
|
562
520
|
requirements:
|
563
521
|
- - ">="
|
564
522
|
- !ruby/object:Gem::Version
|
565
|
-
version: 2.1
|
566
|
-
- !ruby/object:Gem::Dependency
|
567
|
-
name: roadie-rails
|
568
|
-
requirement: !ruby/object:Gem::Requirement
|
569
|
-
requirements:
|
570
|
-
- - ">="
|
571
|
-
- !ruby/object:Gem::Version
|
572
|
-
version: '0'
|
573
|
-
type: :development
|
574
|
-
prerelease: false
|
575
|
-
version_requirements: !ruby/object:Gem::Requirement
|
576
|
-
requirements:
|
577
|
-
- - ">="
|
578
|
-
- !ruby/object:Gem::Version
|
579
|
-
version: '0'
|
523
|
+
version: 2.2.1
|
580
524
|
- !ruby/object:Gem::Dependency
|
581
525
|
name: sqlite3
|
582
526
|
requirement: !ruby/object:Gem::Requirement
|