thredded 0.15.4 → 0.15.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/stylesheets/thredded/base/_alerts.scss +1 -0
  4. data/app/controllers/thredded/application_controller.rb +14 -7
  5. data/app/controllers/thredded/messageboards_controller.rb +5 -6
  6. data/app/controllers/thredded/moderation_controller.rb +28 -18
  7. data/app/controllers/thredded/topics_controller.rb +1 -1
  8. data/app/forms/thredded/post_form.rb +1 -1
  9. data/app/forms/thredded/private_post_form.rb +1 -1
  10. data/app/forms/thredded/private_topic_form.rb +2 -3
  11. data/app/forms/thredded/topic_form.rb +1 -1
  12. data/app/helpers/thredded/application_helper.rb +10 -9
  13. data/app/mailer_previews/thredded/base_mailer_preview.rb +4 -4
  14. data/app/models/concerns/thredded/content_moderation_state.rb +24 -24
  15. data/app/models/concerns/thredded/topic_common.rb +1 -1
  16. data/app/models/concerns/thredded/user_topic_read_state_common.rb +1 -1
  17. data/app/models/thredded/category.rb +1 -1
  18. data/app/models/thredded/messageboard.rb +6 -6
  19. data/app/models/thredded/messageboard_user.rb +4 -1
  20. data/app/models/thredded/post.rb +4 -2
  21. data/app/models/thredded/post_moderation_record.rb +3 -9
  22. data/app/models/thredded/private_topic.rb +6 -5
  23. data/app/models/thredded/topic.rb +6 -4
  24. data/app/models/thredded/topic_category.rb +2 -2
  25. data/app/models/thredded/user_detail.rb +12 -6
  26. data/app/models/thredded/user_extender.rb +22 -22
  27. data/app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb +7 -0
  28. data/app/models/thredded/user_permissions/moderate/none.rb +6 -0
  29. data/app/models/thredded/user_permissions/read/all.rb +7 -0
  30. data/app/models/thredded/user_preference.rb +9 -9
  31. data/app/policies/thredded/messageboard_policy.rb +8 -3
  32. data/app/views/thredded/messageboards/_form.html.erb +3 -2
  33. data/app/views/thredded/messageboards/new.html.erb +1 -1
  34. data/app/views/thredded/private_topics/_form.html.erb +1 -1
  35. data/app/views/thredded/private_topics/edit.html.erb +1 -1
  36. data/app/views/thredded/shared/_field_errors.html.erb +5 -3
  37. data/app/views/thredded/shared/nav/_moderation.html.erb +1 -1
  38. data/app/views/thredded/topics/_form.html.erb +1 -1
  39. data/app/views/thredded/topics/edit.html.erb +1 -1
  40. data/bin/rails +2 -2
  41. data/config/locales/ru.yml +1 -1
  42. data/lib/generators/thredded/install/install_generator.rb +2 -2
  43. data/lib/generators/thredded/install/templates/initializer.rb +3 -0
  44. data/lib/thredded.rb +15 -2
  45. data/lib/thredded/base_notifier.rb +1 -3
  46. data/lib/thredded/database_seeder.rb +2 -5
  47. data/lib/thredded/engine.rb +1 -3
  48. data/lib/thredded/rails_lt_5_2_arel_case_node.rb +4 -4
  49. data/lib/thredded/version.rb +1 -1
  50. metadata +86 -72
@@ -7,9 +7,7 @@ module Thredded
7
7
  fail "Notifier problem: #{notifier.class.name} must respond to #key with a snake_case string"
8
8
  end
9
9
  %i[human_name new_post new_private_post].each do |m|
10
- unless notifier.respond_to?(m)
11
- fail "#{notifier.class.name} must respond to ##{m}"
12
- end
10
+ fail "#{notifier.class.name} must respond to ##{m}" unless notifier.respond_to?(m)
13
11
  end
14
12
  end
15
13
 
@@ -5,9 +5,7 @@ require_relative '../../spec/support/features/fake_content'
5
5
 
6
6
  # rubocop:disable HandleExceptions
7
7
  begin
8
- if FactoryBot.factories.instance_variable_get(:@items).none?
9
- require_relative '../../spec/factories'
10
- end
8
+ require_relative '../../spec/factories' if FactoryBot.factories.instance_variable_get(:@items).none?
11
9
  rescue NameError
12
10
  end
13
11
  # rubocop:enable HandleExceptions
@@ -165,7 +163,7 @@ module Thredded
165
163
  log "Creating #{additional_messageboards.length} additional messageboards...\n"
166
164
  additional_messageboards.each do |(name, description, group_id)|
167
165
  messageboard = Messageboard.create!(name: name, description: description, messageboard_group_id: group_id)
168
- topics = Topics.new(self).create(count: 1 + rand(3), messageboard: messageboard)
166
+ topics = Topics.new(self).create(count: rand(1..3), messageboard: messageboard)
169
167
  Posts.new(self).create(count: (1..2), topics: topics)
170
168
  end
171
169
  end
@@ -441,4 +439,3 @@ module Thredded
441
439
  end
442
440
  end
443
441
  end
444
- # rubocop:enable Metrics/ClassLength
@@ -12,9 +12,7 @@ module Thredded
12
12
 
13
13
  config.to_prepare do
14
14
  Thredded::AllViewHooks.reset_instance!
15
- if Thredded.user_class
16
- Thredded.user_class.send(:include, Thredded::UserExtender)
17
- end
15
+ Thredded.user_class.send(:include, Thredded::UserExtender) if Thredded.user_class
18
16
  end
19
17
 
20
18
  initializer 'thredded.setup_assets' do
@@ -64,7 +64,7 @@ module Arel
64
64
  class DepthFirst < Arel::Visitors::Visitor
65
65
  alias visit_Arel_Nodes_Else unary
66
66
 
67
- def visit_Arel_Nodes_Case(o) # rubocop:disable Style/MethodName
67
+ def visit_Arel_Nodes_Case(o) # rubocop:disable Naming/MethodName
68
68
  visit o.case
69
69
  visit o.conditions
70
70
  visit o.default
@@ -86,7 +86,7 @@ end
86
86
  module Arel
87
87
  module Visitors
88
88
  class ToSql < Arel::Visitors::Reduce
89
- def visit_Arel_Nodes_Case(o, collector) # rubocop:disable Style/MethodName
89
+ def visit_Arel_Nodes_Case(o, collector) # rubocop:disable Naming/MethodName
90
90
  collector << 'CASE '
91
91
  if o.case
92
92
  visit o.case, collector
@@ -103,14 +103,14 @@ module Arel
103
103
  collector << 'END'
104
104
  end
105
105
 
106
- def visit_Arel_Nodes_When(o, collector) # rubocop:disable Style/MethodName
106
+ def visit_Arel_Nodes_When(o, collector) # rubocop:disable Naming/MethodName
107
107
  collector << 'WHEN '
108
108
  visit o.left, collector
109
109
  collector << ' THEN '
110
110
  visit o.right, collector
111
111
  end
112
112
 
113
- def visit_Arel_Nodes_Else(o, collector) # rubocop:disable Style/MethodName
113
+ def visit_Arel_Nodes_Else(o, collector) # rubocop:disable Naming/MethodName
114
114
  collector << 'ELSE '
115
115
  visit o.expr, collector
116
116
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Thredded
4
- VERSION = '0.15.4'
4
+ VERSION = '0.15.5'
5
5
  end
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.15.4
4
+ version: 0.15.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Oliveira
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-07-08 00:00:00.000000000 Z
12
+ date: 2018-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: pundit
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 1.1.0
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 1.1.0
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: active_record_union
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +67,20 @@ dependencies:
81
67
  - - ">="
82
68
  - !ruby/object:Gem::Version
83
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: inline_svg
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: kaminari
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: pundit
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 1.1.0
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 1.1.0
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rails
114
128
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +152,7 @@ dependencies:
138
152
  - !ruby/object:Gem::Version
139
153
  version: '0'
140
154
  - !ruby/object:Gem::Dependency
141
- name: inline_svg
155
+ name: html-pipeline
142
156
  requirement: !ruby/object:Gem::Requirement
143
157
  requirements:
144
158
  - - ">="
@@ -185,20 +199,6 @@ dependencies:
185
199
  - - ">="
186
200
  - !ruby/object:Gem::Version
187
201
  version: 1.8.48
188
- - !ruby/object:Gem::Dependency
189
- name: html-pipeline
190
- requirement: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
- type: :runtime
196
- prerelease: false
197
- version_requirements: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
202
  - !ruby/object:Gem::Dependency
203
203
  name: rinku
204
204
  requirement: !ruby/object:Gem::Requirement
@@ -242,35 +242,35 @@ dependencies:
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  - !ruby/object:Gem::Dependency
245
- name: sass
245
+ name: autoprefixer-rails
246
246
  requirement: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
- version: 3.4.21
250
+ version: '0'
251
251
  type: :runtime
252
252
  prerelease: false
253
253
  version_requirements: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - ">="
256
256
  - !ruby/object:Gem::Version
257
- version: 3.4.21
257
+ version: '0'
258
258
  - !ruby/object:Gem::Dependency
259
- name: autoprefixer-rails
259
+ name: sass
260
260
  requirement: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - ">="
263
263
  - !ruby/object:Gem::Version
264
- version: '0'
264
+ version: 3.4.21
265
265
  type: :runtime
266
266
  prerelease: false
267
267
  version_requirements: !ruby/object:Gem::Requirement
268
268
  requirements:
269
269
  - - ">="
270
270
  - !ruby/object:Gem::Version
271
- version: '0'
271
+ version: 3.4.21
272
272
  - !ruby/object:Gem::Dependency
273
- name: timeago_js
273
+ name: sprockets-es6
274
274
  requirement: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - ">="
@@ -284,7 +284,7 @@ dependencies:
284
284
  - !ruby/object:Gem::Version
285
285
  version: '0'
286
286
  - !ruby/object:Gem::Dependency
287
- name: sprockets-es6
287
+ name: timeago_js
288
288
  requirement: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - ">="
@@ -312,21 +312,21 @@ dependencies:
312
312
  - !ruby/object:Gem::Version
313
313
  version: '2.4'
314
314
  - !ruby/object:Gem::Dependency
315
- name: selenium-webdriver
315
+ name: database_cleaner
316
316
  requirement: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - ">="
319
319
  - !ruby/object:Gem::Version
320
- version: 3.5.0
320
+ version: '0'
321
321
  type: :development
322
322
  prerelease: false
323
323
  version_requirements: !ruby/object:Gem::Requirement
324
324
  requirements:
325
325
  - - ">="
326
326
  - !ruby/object:Gem::Version
327
- version: 3.5.0
327
+ version: '0'
328
328
  - !ruby/object:Gem::Dependency
329
- name: webmock
329
+ name: factory_bot_rails
330
330
  requirement: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - ">="
@@ -340,21 +340,21 @@ dependencies:
340
340
  - !ruby/object:Gem::Version
341
341
  version: '0'
342
342
  - !ruby/object:Gem::Dependency
343
- name: database_cleaner
343
+ name: faker
344
344
  requirement: !ruby/object:Gem::Requirement
345
345
  requirements:
346
346
  - - ">="
347
347
  - !ruby/object:Gem::Version
348
- version: '0'
348
+ version: 1.6.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: '0'
355
+ version: 1.6.2
356
356
  - !ruby/object:Gem::Dependency
357
- name: factory_bot_rails
357
+ name: launchy
358
358
  requirement: !ruby/object:Gem::Requirement
359
359
  requirements:
360
360
  - - ">="
@@ -368,35 +368,49 @@ dependencies:
368
368
  - !ruby/object:Gem::Version
369
369
  version: '0'
370
370
  - !ruby/object:Gem::Dependency
371
- name: faker
371
+ name: rspec-rails
372
372
  requirement: !ruby/object:Gem::Requirement
373
373
  requirements:
374
374
  - - ">="
375
375
  - !ruby/object:Gem::Version
376
- version: 1.6.2
376
+ version: 3.5.0
377
377
  type: :development
378
378
  prerelease: false
379
379
  version_requirements: !ruby/object:Gem::Requirement
380
380
  requirements:
381
381
  - - ">="
382
382
  - !ruby/object:Gem::Version
383
- version: 1.6.2
383
+ version: 3.5.0
384
384
  - !ruby/object:Gem::Dependency
385
- name: launchy
385
+ name: rubocop
386
386
  requirement: !ruby/object:Gem::Requirement
387
387
  requirements:
388
- - - ">="
388
+ - - '='
389
389
  - !ruby/object:Gem::Version
390
- version: '0'
390
+ version: 0.58.2
391
391
  type: :development
392
392
  prerelease: false
393
393
  version_requirements: !ruby/object:Gem::Requirement
394
394
  requirements:
395
- - - ">="
395
+ - - '='
396
396
  - !ruby/object:Gem::Version
397
- version: '0'
397
+ version: 0.58.2
398
398
  - !ruby/object:Gem::Dependency
399
- name: rspec-rails
399
+ name: rubocop-rspec
400
+ requirement: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - '='
403
+ - !ruby/object:Gem::Version
404
+ version: 1.28.0
405
+ type: :development
406
+ prerelease: false
407
+ version_requirements: !ruby/object:Gem::Requirement
408
+ requirements:
409
+ - - '='
410
+ - !ruby/object:Gem::Version
411
+ version: 1.28.0
412
+ - !ruby/object:Gem::Dependency
413
+ name: selenium-webdriver
400
414
  requirement: !ruby/object:Gem::Requirement
401
415
  requirements:
402
416
  - - ">="
@@ -424,21 +438,21 @@ dependencies:
424
438
  - !ruby/object:Gem::Version
425
439
  version: '0'
426
440
  - !ruby/object:Gem::Dependency
427
- name: rubocop
441
+ name: webmock
428
442
  requirement: !ruby/object:Gem::Requirement
429
443
  requirements:
430
- - - '='
444
+ - - ">="
431
445
  - !ruby/object:Gem::Version
432
- version: 0.49.1
446
+ version: '0'
433
447
  type: :development
434
448
  prerelease: false
435
449
  version_requirements: !ruby/object:Gem::Requirement
436
450
  requirements:
437
- - - '='
451
+ - - ">="
438
452
  - !ruby/object:Gem::Version
439
- version: 0.49.1
453
+ version: '0'
440
454
  - !ruby/object:Gem::Dependency
441
- name: rails-i18n
455
+ name: http_accept_language
442
456
  requirement: !ruby/object:Gem::Requirement
443
457
  requirements:
444
458
  - - ">="
@@ -452,21 +466,21 @@ dependencies:
452
466
  - !ruby/object:Gem::Version
453
467
  version: '0'
454
468
  - !ruby/object:Gem::Dependency
455
- name: kaminari-i18n
469
+ name: i18n-tasks
456
470
  requirement: !ruby/object:Gem::Requirement
457
471
  requirements:
458
472
  - - ">="
459
473
  - !ruby/object:Gem::Version
460
- version: '0'
474
+ version: 0.9.18
461
475
  type: :development
462
476
  prerelease: false
463
477
  version_requirements: !ruby/object:Gem::Requirement
464
478
  requirements:
465
479
  - - ">="
466
480
  - !ruby/object:Gem::Version
467
- version: '0'
481
+ version: 0.9.18
468
482
  - !ruby/object:Gem::Dependency
469
- name: http_accept_language
483
+ name: kaminari-i18n
470
484
  requirement: !ruby/object:Gem::Requirement
471
485
  requirements:
472
486
  - - ">="
@@ -508,7 +522,7 @@ dependencies:
508
522
  - !ruby/object:Gem::Version
509
523
  version: '0'
510
524
  - !ruby/object:Gem::Dependency
511
- name: sqlite3
525
+ name: puma
512
526
  requirement: !ruby/object:Gem::Requirement
513
527
  requirements:
514
528
  - - ">="
@@ -522,7 +536,7 @@ dependencies:
522
536
  - !ruby/object:Gem::Version
523
537
  version: '0'
524
538
  - !ruby/object:Gem::Dependency
525
- name: puma
539
+ name: rails-i18n
526
540
  requirement: !ruby/object:Gem::Requirement
527
541
  requirements:
528
542
  - - ">="
@@ -564,19 +578,19 @@ dependencies:
564
578
  - !ruby/object:Gem::Version
565
579
  version: '0'
566
580
  - !ruby/object:Gem::Dependency
567
- name: i18n-tasks
581
+ name: sqlite3
568
582
  requirement: !ruby/object:Gem::Requirement
569
583
  requirements:
570
584
  - - ">="
571
585
  - !ruby/object:Gem::Version
572
- version: 0.9.18
586
+ version: '0'
573
587
  type: :development
574
588
  prerelease: false
575
589
  version_requirements: !ruby/object:Gem::Requirement
576
590
  requirements:
577
591
  - - ">="
578
592
  - !ruby/object:Gem::Version
579
- version: 0.9.18
593
+ version: '0'
580
594
  - !ruby/object:Gem::Dependency
581
595
  name: web-console
582
596
  requirement: !ruby/object:Gem::Requirement
@@ -1036,7 +1050,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1036
1050
  requirements:
1037
1051
  - - "~>"
1038
1052
  - !ruby/object:Gem::Version
1039
- version: '2.1'
1053
+ version: '2.3'
1040
1054
  required_rubygems_version: !ruby/object:Gem::Requirement
1041
1055
  requirements:
1042
1056
  - - ">="