trusty-cms 7.1.2 → 7.2

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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -3
  3. data/Gemfile.lock +127 -111
  4. data/README.md +2 -0
  5. data/app/controllers/admin/resource_controller.rb +1 -1
  6. data/app/controllers/application_controller.rb +15 -0
  7. data/app/models/asset.rb +29 -5
  8. data/app/models/standard_tags.rb +13 -7
  9. data/app/models/user.rb +13 -0
  10. data/lib/string_extensions/string_extensions.rb +4 -2
  11. data/lib/trusty_cms/site_scope_auth_reporter.rb +108 -0
  12. data/lib/trusty_cms/version.rb +1 -1
  13. data/package.json +1 -1
  14. data/spec/controllers/admin/assets_controller_spec.rb +124 -0
  15. data/spec/controllers/admin/changes_controller_spec.rb +72 -0
  16. data/spec/controllers/admin/configuration_controller_spec.rb +49 -0
  17. data/spec/controllers/admin/page_attachments_controller_spec.rb +54 -0
  18. data/spec/controllers/admin/pages_controller_spec.rb +162 -0
  19. data/spec/controllers/admin/preferences_controller_spec.rb +44 -0
  20. data/spec/controllers/admin/security_controller_spec.rb +85 -0
  21. data/spec/controllers/admin/sessions_controller_spec.rb +56 -0
  22. data/spec/controllers/admin/snippets_controller_spec.rb +95 -0
  23. data/spec/controllers/admin/two_factor_controller_spec.rb +63 -0
  24. data/spec/controllers/admin/users_controller_spec.rb +132 -0
  25. data/spec/controllers/page_status_controller_spec.rb +66 -0
  26. data/spec/controllers/site_controller_spec.rb +63 -0
  27. data/spec/dummy/bin/rails +3 -3
  28. data/spec/dummy/bin/rake +2 -2
  29. data/spec/dummy/bin/setup +21 -13
  30. data/spec/dummy/config/boot.rb +1 -1
  31. data/spec/dummy/config/cable.yml +10 -0
  32. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  33. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -2
  34. data/spec/dummy/config/initializers/inflections.rb +4 -4
  35. data/spec/dummy/config/initializers/new_framework_defaults_7_2.rb +70 -0
  36. data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
  37. data/spec/dummy/config/puma.rb +34 -0
  38. data/spec/dummy/config/storage.yml +28 -1
  39. data/spec/dummy/db/migrate/20260729201444_add_service_name_to_active_storage_blobs.active_storage.rb +22 -0
  40. data/spec/dummy/db/migrate/20260729201445_create_active_storage_variant_records.active_storage.rb +27 -0
  41. data/spec/dummy/db/migrate/20260729201446_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +8 -0
  42. data/spec/dummy/public/404.html +6 -6
  43. data/spec/dummy/public/406-unsupported-browser.html +66 -0
  44. data/spec/dummy/public/422.html +6 -6
  45. data/spec/dummy/public/500.html +6 -6
  46. data/spec/dummy/public/icon.png +0 -0
  47. data/spec/dummy/public/icon.svg +3 -0
  48. data/spec/dummy/public/robots.txt +1 -0
  49. data/spec/factories/site.rb +8 -0
  50. data/spec/helpers/admin/configuration_helper_spec.rb +62 -0
  51. data/spec/helpers/admin/node_helper_spec.rb +132 -0
  52. data/spec/helpers/admin/pages_helper_spec.rb +84 -0
  53. data/spec/helpers/admin/references_helper_spec.rb +54 -0
  54. data/spec/helpers/admin/url_helper_spec.rb +71 -0
  55. data/spec/helpers/application_helper_spec.rb +217 -0
  56. data/spec/helpers/scoped_helper_spec.rb +60 -0
  57. data/spec/lib/active_record_extensions_spec.rb +65 -0
  58. data/spec/lib/login_system_spec.rb +61 -0
  59. data/spec/lib/ostruct_spec.rb +33 -0
  60. data/spec/lib/string_extensions_spec.rb +89 -0
  61. data/spec/lib/symbol_extensions_spec.rb +14 -0
  62. data/spec/lib/trusty_cms/config_cache_spec.rb +73 -0
  63. data/spec/models/admins_site_spec.rb +19 -0
  64. data/spec/models/asset_spec.rb +224 -0
  65. data/spec/models/asset_type_spec.rb +137 -0
  66. data/spec/models/file_not_found_page_spec.rb +33 -0
  67. data/spec/models/haml_filter_spec.rb +30 -0
  68. data/spec/models/menu_renderer_spec.rb +63 -0
  69. data/spec/models/page_attachment_spec.rb +29 -0
  70. data/spec/models/page_context_spec.rb +57 -0
  71. data/spec/models/page_field_spec.rb +15 -0
  72. data/spec/models/page_part_spec.rb +33 -0
  73. data/spec/models/page_spec.rb +184 -0
  74. data/spec/models/rails_page_spec.rb +32 -0
  75. data/spec/models/site_spec.rb +93 -0
  76. data/spec/models/snippet_finder_spec.rb +27 -0
  77. data/spec/models/snippet_tags_spec.rb +45 -0
  78. data/spec/models/standard_tags/children_spec.rb +159 -0
  79. data/spec/models/standard_tags/content_spec.rb +168 -0
  80. data/spec/models/standard_tags/meta_spec.rb +86 -0
  81. data/spec/models/standard_tags_spec.rb +32 -0
  82. data/spec/models/status_spec.rb +63 -0
  83. data/spec/models/text_filter_spec.rb +47 -0
  84. data/spec/models/trusty_cms/config_spec.rb +69 -0
  85. data/spec/models/trusty_cms/page_response_cache_director_spec.rb +72 -0
  86. data/spec/models/user_action_observer_spec.rb +39 -0
  87. data/spec/models/user_serialize_telemetry_spec.rb +124 -0
  88. data/spec/rails_helper.rb +13 -6
  89. data/spec/requests/admin/snippets_spec.rb +81 -0
  90. data/spec/spec_helper.rb +17 -3
  91. data/spec/support/active_record_encryption.rb +10 -0
  92. data/spec/support/asset_type_registry.rb +29 -0
  93. data/trusty_cms.gemspec +4 -4
  94. data/yarn.lock +273 -259
  95. metadata +157 -14
  96. data/spec/controllers/assets_controller.rb +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f28f9884a07d4a5b4c582c2e490af233fa40d9e275bf531c0e103f8a16fb1d2
4
- data.tar.gz: 1296987f36ad6cdd537e654978fca42b74519b1c727474c3725d1e81afc6a662
3
+ metadata.gz: 2378bbe6b853e3290648de1a8a832b61a25303f3078f4903ac70581a031bb3a5
4
+ data.tar.gz: 3e704c6349a8bf385190cc70ee6cf0021aa8c0cc575d5e033a3c1423a32e5e20
5
5
  SHA512:
6
- metadata.gz: 30e7296886c47d33276f7612b24c24a310a45c99c60c7907b52bdbf6b11c264c8ae4705ccfe4e187c7b0bd2d11cc6077d12ad7f54e9e9e3cf413a283bd7211a3
7
- data.tar.gz: f41957d9f3c0e03e8e4af00eda15710e577350659aa7b41f6182c01b31d9e8db3d326c9fe791dd009b5cae6c92ef1bc564597bd5fc0815fb4c0b2c9f283e5d9a
6
+ metadata.gz: b4c137e5c84e08a9fc8395282986fe8a7b8b0c7c28d6e3b888b60a4e8a0c19f30d1520bc92a5580c8a3472961470e57558215ff3965546626dbb934863cd9f07
7
+ data.tar.gz: 42f087dbc0e78b43ffb48ad804b891992eafafe7d8e3ee5589b2d983902eaef2590f5325bb03f1df568227e52ae4a391d7ca8000432e9be82f59710c332f34b4
data/Gemfile CHANGED
@@ -16,18 +16,19 @@ group :development, :test do
16
16
  gem 'acts_as_list'
17
17
  gem 'database_cleaner'
18
18
  gem 'devise-two-factor'
19
- gem 'factory_bot_rails', '6.4.4'
19
+ gem 'factory_bot_rails', '6.5.1'
20
20
  gem 'file_validators'
21
21
  gem 'jsbundling-rails', '~> 1.3'
22
22
  gem 'launchy', '~> 3.0.1'
23
23
  gem 'mysql2'
24
24
  gem 'paper_trail', '~> 16.0.0'
25
- gem 'paper_trail-association_tracking', '~> 2.2.1'
25
+ gem 'paper_trail-association_tracking', '~> 2.3.0'
26
26
  gem 'poltergeist', '~> 1.18.1'
27
27
  gem 'pry-byebug'
28
- gem 'psych', '5.2.2'
28
+ gem 'psych', '5.4.0'
29
29
  gem 'rails-observers'
30
30
  gem 'ransack'
31
+ gem 'rspec_junit_formatter'
31
32
  gem 'rspec-rails', '~> 7.1.1'
32
33
  gem 'simplecov'
33
34
  gem 'simplecov-lcov'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (7.1.2)
4
+ trusty-cms (7.2)
5
5
  RedCloth (= 4.3.4)
6
6
  activestorage-validator
7
7
  acts_as_list (>= 0.9.5, < 1.3.0)
@@ -24,15 +24,15 @@ PATH
24
24
  mutex_m
25
25
  mysql2
26
26
  paper_trail (~> 16.0.0)
27
- paper_trail-association_tracking (~> 2.2.1)
28
- psych (= 5.2.2)
27
+ paper_trail-association_tracking (>= 2.2.1, < 2.4.0)
28
+ psych (= 5.4.0)
29
29
  rack (>= 2.0.1, < 3.2.0)
30
30
  rack-cache (~> 1.7)
31
31
  radius (~> 0.8)
32
- rails (~> 7.2.2.1)
32
+ rails (>= 7.2, < 8.0)
33
33
  rake (< 14.0)
34
34
  ransack (~> 4.2.1)
35
- rdoc (>= 5.1, < 7.0)
35
+ rdoc (>= 5.1, < 9.0)
36
36
  roadie-rails
37
37
  rqrcode
38
38
  sass-rails
@@ -46,68 +46,70 @@ GEM
46
46
  remote: https://rubygems.org/
47
47
  specs:
48
48
  RedCloth (4.3.4)
49
- actioncable (7.2.2.1)
50
- actionpack (= 7.2.2.1)
51
- activesupport (= 7.2.2.1)
49
+ actioncable (7.2.3.2)
50
+ actionpack (= 7.2.3.2)
51
+ activesupport (= 7.2.3.2)
52
52
  nio4r (~> 2.0)
53
53
  websocket-driver (>= 0.6.1)
54
54
  zeitwerk (~> 2.6)
55
- actionmailbox (7.2.2.1)
56
- actionpack (= 7.2.2.1)
57
- activejob (= 7.2.2.1)
58
- activerecord (= 7.2.2.1)
59
- activestorage (= 7.2.2.1)
60
- activesupport (= 7.2.2.1)
55
+ actionmailbox (7.2.3.2)
56
+ actionpack (= 7.2.3.2)
57
+ activejob (= 7.2.3.2)
58
+ activerecord (= 7.2.3.2)
59
+ activestorage (= 7.2.3.2)
60
+ activesupport (= 7.2.3.2)
61
61
  mail (>= 2.8.0)
62
- actionmailer (7.2.2.1)
63
- actionpack (= 7.2.2.1)
64
- actionview (= 7.2.2.1)
65
- activejob (= 7.2.2.1)
66
- activesupport (= 7.2.2.1)
62
+ actionmailer (7.2.3.2)
63
+ actionpack (= 7.2.3.2)
64
+ actionview (= 7.2.3.2)
65
+ activejob (= 7.2.3.2)
66
+ activesupport (= 7.2.3.2)
67
67
  mail (>= 2.8.0)
68
68
  rails-dom-testing (~> 2.2)
69
- actionpack (7.2.2.1)
70
- actionview (= 7.2.2.1)
71
- activesupport (= 7.2.2.1)
69
+ actionpack (7.2.3.2)
70
+ actionview (= 7.2.3.2)
71
+ activesupport (= 7.2.3.2)
72
+ cgi
72
73
  nokogiri (>= 1.8.5)
73
74
  racc
74
- rack (>= 2.2.4, < 3.2)
75
+ rack (>= 2.2.4, < 3.3)
75
76
  rack-session (>= 1.0.1)
76
77
  rack-test (>= 0.6.3)
77
78
  rails-dom-testing (~> 2.2)
78
79
  rails-html-sanitizer (~> 1.6)
79
80
  useragent (~> 0.16)
80
- actiontext (7.2.2.1)
81
- actionpack (= 7.2.2.1)
82
- activerecord (= 7.2.2.1)
83
- activestorage (= 7.2.2.1)
84
- activesupport (= 7.2.2.1)
81
+ actiontext (7.2.3.2)
82
+ actionpack (= 7.2.3.2)
83
+ activerecord (= 7.2.3.2)
84
+ activestorage (= 7.2.3.2)
85
+ activesupport (= 7.2.3.2)
85
86
  globalid (>= 0.6.0)
86
87
  nokogiri (>= 1.8.5)
87
- actionview (7.2.2.1)
88
- activesupport (= 7.2.2.1)
88
+ actionview (7.2.3.2)
89
+ activesupport (= 7.2.3.2)
89
90
  builder (~> 3.1)
91
+ cgi
90
92
  erubi (~> 1.11)
91
93
  rails-dom-testing (~> 2.2)
92
94
  rails-html-sanitizer (~> 1.6)
93
- activejob (7.2.2.1)
94
- activesupport (= 7.2.2.1)
95
+ activejob (7.2.3.2)
96
+ activesupport (= 7.2.3.2)
95
97
  globalid (>= 0.3.6)
96
- activemodel (7.2.2.1)
97
- activesupport (= 7.2.2.1)
98
- activerecord (7.2.2.1)
99
- activemodel (= 7.2.2.1)
100
- activesupport (= 7.2.2.1)
98
+ activemodel (7.2.3.2)
99
+ activesupport (= 7.2.3.2)
100
+ activerecord (7.2.3.2)
101
+ activemodel (= 7.2.3.2)
102
+ activesupport (= 7.2.3.2)
101
103
  timeout (>= 0.4.0)
102
- activestorage (7.2.2.1)
103
- actionpack (= 7.2.2.1)
104
- activejob (= 7.2.2.1)
105
- activerecord (= 7.2.2.1)
106
- activesupport (= 7.2.2.1)
104
+ activestorage (7.2.3.2)
105
+ actionpack (= 7.2.3.2)
106
+ activejob (= 7.2.3.2)
107
+ activerecord (= 7.2.3.2)
108
+ activesupport (= 7.2.3.2)
107
109
  marcel (~> 1.0)
108
110
  activestorage-validator (0.4.0)
109
111
  rails (>= 6.1.0)
110
- activesupport (7.2.2.1)
112
+ activesupport (7.2.3.2)
111
113
  base64
112
114
  benchmark (>= 0.3)
113
115
  bigdecimal
@@ -116,10 +118,10 @@ GEM
116
118
  drb
117
119
  i18n (>= 1.6, < 2)
118
120
  logger (>= 1.4.2)
119
- minitest (>= 5.1)
121
+ minitest (>= 5.1, < 6)
120
122
  securerandom (>= 0.3)
121
123
  tzinfo (~> 2.0, >= 2.0.5)
122
- acts_as_list (1.2.4)
124
+ acts_as_list (1.2.6)
123
125
  activerecord (>= 6.1)
124
126
  activesupport (>= 6.1)
125
127
  acts_as_tree (2.9.1)
@@ -131,7 +133,8 @@ GEM
131
133
  benchmark (0.5.0)
132
134
  bigdecimal (4.1.2)
133
135
  builder (3.3.0)
134
- byebug (11.1.3)
136
+ byebug (13.0.0)
137
+ reline (>= 0.6.0)
135
138
  capybara (3.40.0)
136
139
  addressable
137
140
  matrix
@@ -141,16 +144,18 @@ GEM
141
144
  rack-test (>= 0.6.3)
142
145
  regexp_parser (>= 1.5, < 3.0)
143
146
  xpath (~> 3.2)
147
+ cgi (0.5.2)
144
148
  childprocess (5.1.0)
145
149
  logger (~> 1.5)
146
150
  chunky_png (1.4.0)
147
151
  cliver (0.3.2)
148
152
  coderay (1.1.3)
149
- concurrent-ruby (1.3.6)
153
+ concurrent-ruby (1.3.8)
150
154
  connection_pool (3.0.2)
151
- crass (1.0.6)
152
- css_parser (1.22.0)
155
+ crass (1.0.7)
156
+ css_parser (3.0.0)
153
157
  addressable
158
+ ssrf_filter (~> 1.5)
154
159
  csso-rails (0.9.0)
155
160
  execjs (>= 1)
156
161
  csv (3.3.0)
@@ -178,14 +183,14 @@ GEM
178
183
  diffy (3.4.4)
179
184
  docile (1.4.1)
180
185
  drb (2.2.3)
181
- erb (6.0.4)
186
+ erb (6.0.6)
182
187
  erubi (1.13.1)
183
188
  execjs (2.10.0)
184
- factory_bot (6.5.0)
185
- activesupport (>= 5.0.0)
186
- factory_bot_rails (6.4.4)
189
+ factory_bot (6.6.0)
190
+ activesupport (>= 6.1.0)
191
+ factory_bot_rails (6.5.1)
187
192
  factory_bot (~> 6.5)
188
- railties (>= 5.0.0)
193
+ railties (>= 6.1.0)
189
194
  ffi (1.17.0-aarch64-linux-gnu)
190
195
  ffi (1.17.0-aarch64-linux-musl)
191
196
  ffi (1.17.0-arm-linux-gnu)
@@ -199,7 +204,7 @@ GEM
199
204
  file_validators (3.0.0)
200
205
  activemodel (>= 3.2)
201
206
  mime-types (>= 1.0)
202
- globalid (1.2.1)
207
+ globalid (1.4.0)
203
208
  activesupport (>= 6.1)
204
209
  haml (6.3.0)
205
210
  temple (>= 0.8.2)
@@ -216,7 +221,7 @@ GEM
216
221
  csv
217
222
  mini_mime (>= 1.0.0)
218
223
  multi_xml (>= 0.5.2)
219
- i18n (1.14.8)
224
+ i18n (1.15.2)
220
225
  concurrent-ruby (~> 1.0)
221
226
  image_processing (1.13.0)
222
227
  mini_magick (>= 4.9.5, < 5)
@@ -246,15 +251,16 @@ GEM
246
251
  libv8-node (18.19.0.0-x86_64-linux)
247
252
  libv8-node (18.19.0.0-x86_64-linux-musl)
248
253
  logger (1.7.0)
249
- loofah (2.25.1)
254
+ loofah (2.25.2)
250
255
  crass (~> 1.0.2)
251
256
  nokogiri (>= 1.12.0)
252
- mail (2.8.1)
257
+ mail (2.9.1)
258
+ logger
253
259
  mini_mime (>= 0.1.1)
254
260
  net-imap
255
261
  net-pop
256
262
  net-smtp
257
- marcel (1.0.4)
263
+ marcel (1.2.1)
258
264
  matrix (0.4.2)
259
265
  method_source (1.1.0)
260
266
  mime-types (3.6.0)
@@ -266,15 +272,13 @@ GEM
266
272
  mini_portile2 (2.8.9)
267
273
  mini_racer (0.16.0)
268
274
  libv8-node (~> 18.19.0.0)
269
- minitest (6.0.6)
270
- drb (~> 2.0)
271
- prism (~> 1.5)
275
+ minitest (5.27.0)
272
276
  multi_xml (0.9.1)
273
277
  bigdecimal (>= 3.1, < 5)
274
278
  multipart-post (2.4.1)
275
279
  mutex_m (0.3.0)
276
280
  mysql2 (0.5.6)
277
- net-imap (0.5.15)
281
+ net-imap (0.6.6)
278
282
  date
279
283
  net-protocol
280
284
  net-pop (0.1.2)
@@ -283,47 +287,48 @@ GEM
283
287
  timeout
284
288
  net-smtp (0.5.1)
285
289
  net-protocol
286
- nio4r (2.7.4)
287
- nokogiri (1.19.3)
290
+ nio4r (2.7.5)
291
+ nokogiri (1.19.4)
288
292
  mini_portile2 (~> 2.8.2)
289
293
  racc (~> 1.4)
290
- nokogiri (1.19.3-aarch64-linux-gnu)
294
+ nokogiri (1.19.4-aarch64-linux-gnu)
291
295
  racc (~> 1.4)
292
- nokogiri (1.19.3-aarch64-linux-musl)
296
+ nokogiri (1.19.4-aarch64-linux-musl)
293
297
  racc (~> 1.4)
294
- nokogiri (1.19.3-arm-linux-gnu)
298
+ nokogiri (1.19.4-arm-linux-gnu)
295
299
  racc (~> 1.4)
296
- nokogiri (1.19.3-arm-linux-musl)
300
+ nokogiri (1.19.4-arm-linux-musl)
297
301
  racc (~> 1.4)
298
- nokogiri (1.19.3-arm64-darwin)
302
+ nokogiri (1.19.4-arm64-darwin)
299
303
  racc (~> 1.4)
300
- nokogiri (1.19.3-x86_64-darwin)
304
+ nokogiri (1.19.4-x86_64-darwin)
301
305
  racc (~> 1.4)
302
- nokogiri (1.19.3-x86_64-linux-gnu)
306
+ nokogiri (1.19.4-x86_64-linux-gnu)
303
307
  racc (~> 1.4)
304
- nokogiri (1.19.3-x86_64-linux-musl)
308
+ nokogiri (1.19.4-x86_64-linux-musl)
305
309
  racc (~> 1.4)
306
310
  orm_adapter (0.5.0)
307
311
  paper_trail (16.0.0)
308
312
  activerecord (>= 6.1)
309
313
  request_store (~> 1.4)
310
- paper_trail-association_tracking (2.2.1)
314
+ paper_trail-association_tracking (2.3.0)
311
315
  paper_trail (>= 12.0)
312
316
  poltergeist (1.18.1)
313
317
  capybara (>= 2.1, < 4)
314
318
  cliver (~> 0.3.1)
315
319
  websocket-driver (>= 0.2.0)
316
- pp (0.6.3)
320
+ pp (0.6.4)
317
321
  prettyprint
318
322
  prettyprint (0.2.0)
319
323
  prism (1.9.0)
320
- pry (0.14.2)
324
+ pry (0.16.0)
321
325
  coderay (~> 1.1)
322
326
  method_source (~> 1.0)
323
- pry-byebug (3.10.1)
324
- byebug (~> 11.0)
325
- pry (>= 0.13, < 0.15)
326
- psych (5.2.2)
327
+ reline (>= 0.6.0)
328
+ pry-byebug (3.12.0)
329
+ byebug (~> 13.0)
330
+ pry (>= 0.13, < 0.17)
331
+ psych (5.4.0)
327
332
  date
328
333
  stringio
329
334
  public_suffix (7.0.5)
@@ -339,45 +344,52 @@ GEM
339
344
  rackup (2.3.1)
340
345
  rack (>= 3)
341
346
  radius (0.8.0)
342
- rails (7.2.2.1)
343
- actioncable (= 7.2.2.1)
344
- actionmailbox (= 7.2.2.1)
345
- actionmailer (= 7.2.2.1)
346
- actionpack (= 7.2.2.1)
347
- actiontext (= 7.2.2.1)
348
- actionview (= 7.2.2.1)
349
- activejob (= 7.2.2.1)
350
- activemodel (= 7.2.2.1)
351
- activerecord (= 7.2.2.1)
352
- activestorage (= 7.2.2.1)
353
- activesupport (= 7.2.2.1)
347
+ rails (7.2.3.2)
348
+ actioncable (= 7.2.3.2)
349
+ actionmailbox (= 7.2.3.2)
350
+ actionmailer (= 7.2.3.2)
351
+ actionpack (= 7.2.3.2)
352
+ actiontext (= 7.2.3.2)
353
+ actionview (= 7.2.3.2)
354
+ activejob (= 7.2.3.2)
355
+ activemodel (= 7.2.3.2)
356
+ activerecord (= 7.2.3.2)
357
+ activestorage (= 7.2.3.2)
358
+ activesupport (= 7.2.3.2)
354
359
  bundler (>= 1.15.0)
355
- railties (= 7.2.2.1)
360
+ railties (= 7.2.3.2)
356
361
  rails-dom-testing (2.3.0)
357
362
  activesupport (>= 5.0.0)
358
363
  minitest
359
364
  nokogiri (>= 1.6)
360
- rails-html-sanitizer (1.7.0)
361
- loofah (~> 2.25)
365
+ rails-html-sanitizer (1.7.1)
366
+ loofah (~> 2.25, >= 2.25.2)
362
367
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
363
368
  rails-observers (0.1.5)
364
369
  activemodel (>= 4.0)
365
- railties (7.2.2.1)
366
- actionpack (= 7.2.2.1)
367
- activesupport (= 7.2.2.1)
370
+ railties (7.2.3.2)
371
+ actionpack (= 7.2.3.2)
372
+ activesupport (= 7.2.3.2)
373
+ cgi
368
374
  irb (~> 1.13)
369
375
  rackup (>= 1.0.0)
370
376
  rake (>= 12.2)
371
377
  thor (~> 1.0, >= 1.2.2)
378
+ tsort (>= 0.2)
372
379
  zeitwerk (~> 2.6)
373
380
  rake (13.4.2)
374
381
  ransack (4.2.1)
375
382
  activerecord (>= 6.1.5)
376
383
  activesupport (>= 6.1.5)
377
384
  i18n
378
- rdoc (6.17.0)
385
+ rbs (4.1.0)
386
+ logger
387
+ prism (>= 1.6.0)
388
+ tsort
389
+ rdoc (8.0.0)
379
390
  erb
380
- psych (>= 4.0.0)
391
+ prism (>= 1.6.0)
392
+ rbs (>= 4.0.0)
381
393
  tsort
382
394
  regexp_parser (2.9.2)
383
395
  reline (0.6.3)
@@ -387,17 +399,17 @@ GEM
387
399
  responders (3.2.0)
388
400
  actionpack (>= 7.0)
389
401
  railties (>= 7.0)
390
- roadie (5.2.1)
391
- css_parser (~> 1.4)
402
+ roadie (5.3.1)
403
+ css_parser (>= 1.4, < 4.0)
392
404
  nokogiri (~> 1.15)
393
- roadie-rails (3.3.0)
394
- railties (>= 5.1, < 8.1)
405
+ roadie-rails (3.4.0)
406
+ railties (>= 5.1, < 8.2)
395
407
  roadie (~> 5.0)
396
408
  rotp (6.3.0)
397
- rqrcode (3.1.0)
409
+ rqrcode (3.2.0)
398
410
  chunky_png (~> 1.0)
399
411
  rqrcode_core (~> 2.0)
400
- rqrcode_core (2.0.0)
412
+ rqrcode_core (2.1.0)
401
413
  rspec-core (3.13.4)
402
414
  rspec-support (~> 3.13.0)
403
415
  rspec-expectations (3.13.5)
@@ -415,6 +427,8 @@ GEM
415
427
  rspec-mocks (~> 3.13)
416
428
  rspec-support (~> 3.13)
417
429
  rspec-support (3.13.4)
430
+ rspec_junit_formatter (0.6.0)
431
+ rspec-core (>= 2, < 4, != 2.12.0)
418
432
  ruby-vips (2.2.2)
419
433
  ffi (~> 1.12)
420
434
  logger
@@ -443,6 +457,7 @@ GEM
443
457
  actionpack (>= 6.1)
444
458
  activesupport (>= 6.1)
445
459
  sprockets (>= 3.0.0)
460
+ ssrf_filter (1.5.0)
446
461
  stringex (2.8.6)
447
462
  stringio (3.2.0)
448
463
  temple (0.10.3)
@@ -456,11 +471,11 @@ GEM
456
471
  concurrent-ruby (~> 1.0)
457
472
  uglifier (4.2.1)
458
473
  execjs (>= 0.3.0, < 3)
459
- uri (1.0.2)
474
+ uri (1.0.4)
460
475
  useragent (0.16.11)
461
476
  warden (1.2.9)
462
477
  rack (>= 2.0.9)
463
- websocket-driver (0.8.0)
478
+ websocket-driver (0.8.2)
464
479
  base64
465
480
  websocket-extensions (>= 0.1.0)
466
481
  websocket-extensions (0.1.5)
@@ -486,19 +501,20 @@ DEPENDENCIES
486
501
  acts_as_list
487
502
  database_cleaner
488
503
  devise-two-factor
489
- factory_bot_rails (= 6.4.4)
504
+ factory_bot_rails (= 6.5.1)
490
505
  file_validators
491
506
  jsbundling-rails (~> 1.3)
492
507
  launchy (~> 3.0.1)
493
508
  mysql2
494
509
  paper_trail (~> 16.0.0)
495
- paper_trail-association_tracking (~> 2.2.1)
510
+ paper_trail-association_tracking (~> 2.3.0)
496
511
  poltergeist (~> 1.18.1)
497
512
  pry-byebug
498
- psych (= 5.2.2)
513
+ psych (= 5.4.0)
499
514
  rails-observers
500
515
  ransack
501
516
  rspec-rails (~> 7.1.1)
517
+ rspec_junit_formatter
502
518
  simplecov
503
519
  simplecov-lcov
504
520
  trusty-cms!
data/README.md CHANGED
@@ -12,6 +12,8 @@ Rails engine and is built to be installed into an existing Rails 7 application a
12
12
 
13
13
  CircleCI: [![CircleCI](https://circleci.com/gh/pgharts/trusty-cms/tree/master.svg?style=shield)](https://circleci.com/gh/pgharts/trusty-cms/tree/master)
14
14
 
15
+ Coverage: [![Coverage](https://qlty.sh/badges/4cf4f7cc-d0e8-4559-93ec-685866f5645b/test_coverage.svg)](https://qlty.sh/gh/pgharts/projects/trusty-cms)
16
+
15
17
  Qlty: [![Maintainability](https://qlty.sh/gh/pgharts/projects/trusty-cms/maintainability.svg)](https://qlty.sh/gh/pgharts/projects/trusty-cms)
16
18
 
17
19
  TrustyCMS features:
@@ -42,7 +42,7 @@ class Admin::ResourceController < ApplicationController
42
42
  r.update.publish(:xml, :json) { head :ok }
43
43
  r.update.default { redirect_to redirect_url }
44
44
 
45
- r.destroy.publish(:xml, :json) { head :deleted }
45
+ r.destroy.publish(:xml, :json) { head :ok }
46
46
  r.destroy.default { redirect_to redirect_url }
47
47
  end
48
48
 
@@ -5,6 +5,14 @@ class ApplicationController < ActionController::Base
5
5
  prepend_view_path("#{TRUSTY_CMS_ROOT}/app/views")
6
6
 
7
7
  protect_from_forgery with: :exception
8
+ # Capture the request host before authentication runs so the site-scope logout
9
+ # telemetry (issue #1040) can compare the host's site to the (global) current
10
+ # site. Thread.current is per-thread and safe across concurrent requests —
11
+ # unlike the class-level Page.current_site the telemetry is investigating.
12
+ # An around_action (prepended so it wraps authenticate_user!) guarantees the
13
+ # value is cleared even if the request raises, so it can't leak into the next
14
+ # request handled by the same thread.
15
+ prepend_around_action :with_request_host_for_telemetry
8
16
  before_action :authenticate_user!
9
17
  before_action :configure_permitted_parameters, if: :devise_controller?
10
18
  before_action :set_timezone
@@ -53,6 +61,13 @@ class ApplicationController < ActionController::Base
53
61
 
54
62
  private
55
63
 
64
+ def with_request_host_for_telemetry
65
+ Thread.current[:trusty_request_host] = request.host
66
+ yield
67
+ ensure
68
+ Thread.current[:trusty_request_host] = nil
69
+ end
70
+
56
71
  def set_mailer
57
72
  ActionMailer::Base.default_url_options[:host] = request.host_with_port
58
73
  end
data/app/models/asset.rb CHANGED
@@ -83,8 +83,17 @@ class Asset < ActiveRecord::Base
83
83
  self[:asset_file_size]
84
84
  end
85
85
 
86
- delegate :active_storage_styles, :style_dimensions, :style_format,
87
- to: :asset_type
86
+ def active_storage_styles
87
+ asset_type&.active_storage_styles || {}
88
+ end
89
+
90
+ def style_dimensions(style_name)
91
+ asset_type&.style_dimensions(style_name)
92
+ end
93
+
94
+ def style_format(style_name)
95
+ asset_type&.style_format(style_name)
96
+ end
88
97
 
89
98
  def pdf?
90
99
  content_type == 'application/pdf'
@@ -340,13 +349,28 @@ class Asset < ActiveRecord::Base
340
349
 
341
350
  # this is a convenience for image-pickers
342
351
  def self.thumbnail_options
343
- asset_sizes = thumbnail_sizes.map do |k, v|
352
+ # The :original style is represented by the explicit entry prepended below,
353
+ # so skip it here to avoid a duplicate (and blank) "original" option.
354
+ asset_sizes = thumbnail_sizes.reject { |k, _| k.to_sym == :original }.map do |k, v|
344
355
  size_id = k
345
- size_description = "#{k}: "
346
- size_description << (v.is_a?(Array) ? v.join(' as ') : v)
356
+ size_description = "#{k}: #{describe_style(v)}"
347
357
  [size_description, size_id]
348
358
  end.sort_by { |pair| pair.last.to_s }
349
359
  asset_sizes.unshift ['Original (as uploaded)', 'original']
350
360
  asset_sizes
351
361
  end
362
+
363
+ # Renders a style definition into a short human-readable description for a
364
+ # picker. ActiveStorage styles are hashes (e.g. {geometry: '100x100#',
365
+ # format: :png}); older definitions may be arrays or plain strings.
366
+ def self.describe_style(style)
367
+ case style
368
+ when Hash
369
+ [style[:geometry], style[:format]].compact.join(' as ')
370
+ when Array
371
+ style.join(' as ')
372
+ else
373
+ style.to_s
374
+ end
375
+ end
352
376
  end
@@ -52,8 +52,7 @@ module StandardTags
52
52
  }
53
53
  tag 'children:count' do |tag|
54
54
  options = children_find_options(tag)
55
- options.delete(:order) # Order is irrelevant
56
- tag.locals.children.count(options)
55
+ tag.locals.children.where(options[:conditions]).count
57
56
  end
58
57
 
59
58
  desc %{
@@ -66,7 +65,7 @@ module StandardTags
66
65
  }
67
66
  tag 'children:first' do |tag|
68
67
  options = children_find_options(tag)
69
- children = tag.locals.children.where(options)
68
+ children = tag.locals.children.where(options[:conditions]).order(options[:order])
70
69
  if first = children.first
71
70
  tag.locals.page = first
72
71
  tag.expand
@@ -83,7 +82,7 @@ module StandardTags
83
82
  }
84
83
  tag 'children:last' do |tag|
85
84
  options = children_find_options(tag)
86
- children = tag.locals.children.where(options)
85
+ children = tag.locals.children.where(options[:conditions]).order(options[:order])
87
86
  if last = children.last
88
87
  tag.locals.page = last
89
88
  tag.expand
@@ -942,7 +941,14 @@ module StandardTags
942
941
  paging = pagination_find_options(tag)
943
942
  result = []
944
943
  tag.locals.previous_headers = {}
945
- displayed_children = paging ? findable.paginate(options.merge(paging)) : findable.all.where(options[:conditions]).order(options[:order])
944
+ scoped = findable.where(options[:conditions]).order(options[:order])
945
+ if paging
946
+ displayed_children = scoped.paginate(paging)
947
+ else
948
+ scoped = scoped.limit(options[:limit]) if options[:limit]
949
+ scoped = scoped.offset(options[:offset]) if options[:offset]
950
+ displayed_children = scoped
951
+ end
946
952
  displayed_children.each_with_index do |item, i|
947
953
  tag.locals.child = item
948
954
  tag.locals.page = item
@@ -989,13 +995,13 @@ module StandardTags
989
995
 
990
996
  status = attr[:status]
991
997
  if status == 'all'
992
- options[:conditions] = ['virtual = ?', false]
998
+ options[:conditions] = ['`virtual` = ?', false]
993
999
  else
994
1000
  stat = Status[status]
995
1001
  if stat.nil?
996
1002
  raise TagError.new(%{`status' attribute of `each' tag must be set to a valid status})
997
1003
  else
998
- options[:conditions] = ['(virtual = ?) and (status_id = ?)', false, stat.id]
1004
+ options[:conditions] = ['(`virtual` = ?) and (status_id = ?)', false, stat.id]
999
1005
  end
1000
1006
  end
1001
1007
  options