Skip to content

Commit a6e0dec

Browse files
Update Rails to v7.2 (decidim#14784)
* Bump Rails to v7.2 * Set branch * Set rails 7.1 defaults * Successfully generate test_app * Fix (Taxonomies): PG::UndefinedFunction: ERROR: operator does not exist: integer[] @> text[] * Fix activeStorage url * Fix: PG::SyntaxError: ERROR: syntax error at or near "{" LINE 1: ..."decidim_users"."type" = $1 AND (extended_data @> {"ephemera... * Fix: PG::SyntaxError: ERROR: syntax error at or near "{" LINE 1: ...dim_action_logs"."resource_id" = $2 AND (extra @> {"edit":tr... * Fix: private method `warn' called for class ActiveSupport::Deprecation * Fix: PG::SyntaxError: ERROR: syntax error at or near "$3" LINE 1: ...ings->'global'->>'geocoding_enabled')::boolean is $3 or mani... * Fix: Unable to find link or button with id dc-dialog-accept * Fix encoding issues on TimeWithZone * Fix: PG::NotNullViolation: ERROR: null value in column "record_id" of relation "active_storage_attachments" violates not-null constraint * ArgumentError: Decidim::Proposals::Proposal model aliases `state`, but `state` is not an attribute. Use `alias_method :internal_state, :state` or define the method manually. (ArgumentError) * Disable job processing * Fix flaky specs caused by jobs not being finished when assertion is performed * Running rubocops * Update decidim-generators/lib/decidim/generators/app_generator.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Attempt to fix the Comments specs * Attempt to fix the Comments specs #2 * Apply suggestions from code review Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update active_job.rb --------- Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
1 parent 832ed5e commit a6e0dec

21 files changed

Lines changed: 174 additions & 173 deletions

File tree

Gemfile.lock

Lines changed: 68 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ PATH
9696
premailer-rails (~> 1.10)
9797
rack (~> 2.2, >= 2.2.8.1)
9898
rack-attack (~> 6.0)
99-
rails (~> 7.1.0)
99+
rails (~> 7.2.0)
100100
rails-i18n (~> 7.0)
101101
ransack (~> 4.2.0)
102102
redis (~> 4.1)
@@ -203,104 +203,98 @@ PATH
203203
GEM
204204
remote: https://rubygems.org/
205205
specs:
206-
actioncable (7.1.5.1)
207-
actionpack (= 7.1.5.1)
208-
activesupport (= 7.1.5.1)
206+
actioncable (7.2.2.1)
207+
actionpack (= 7.2.2.1)
208+
activesupport (= 7.2.2.1)
209209
nio4r (~> 2.0)
210210
websocket-driver (>= 0.6.1)
211211
zeitwerk (~> 2.6)
212-
actionmailbox (7.1.5.1)
213-
actionpack (= 7.1.5.1)
214-
activejob (= 7.1.5.1)
215-
activerecord (= 7.1.5.1)
216-
activestorage (= 7.1.5.1)
217-
activesupport (= 7.1.5.1)
218-
mail (>= 2.7.1)
219-
net-imap
220-
net-pop
221-
net-smtp
222-
actionmailer (7.1.5.1)
223-
actionpack (= 7.1.5.1)
224-
actionview (= 7.1.5.1)
225-
activejob (= 7.1.5.1)
226-
activesupport (= 7.1.5.1)
227-
mail (~> 2.5, >= 2.5.4)
228-
net-imap
229-
net-pop
230-
net-smtp
212+
actionmailbox (7.2.2.1)
213+
actionpack (= 7.2.2.1)
214+
activejob (= 7.2.2.1)
215+
activerecord (= 7.2.2.1)
216+
activestorage (= 7.2.2.1)
217+
activesupport (= 7.2.2.1)
218+
mail (>= 2.8.0)
219+
actionmailer (7.2.2.1)
220+
actionpack (= 7.2.2.1)
221+
actionview (= 7.2.2.1)
222+
activejob (= 7.2.2.1)
223+
activesupport (= 7.2.2.1)
224+
mail (>= 2.8.0)
231225
rails-dom-testing (~> 2.2)
232-
actionpack (7.1.5.1)
233-
actionview (= 7.1.5.1)
234-
activesupport (= 7.1.5.1)
226+
actionpack (7.2.2.1)
227+
actionview (= 7.2.2.1)
228+
activesupport (= 7.2.2.1)
235229
nokogiri (>= 1.8.5)
236230
racc
237-
rack (>= 2.2.4)
231+
rack (>= 2.2.4, < 3.2)
238232
rack-session (>= 1.0.1)
239233
rack-test (>= 0.6.3)
240234
rails-dom-testing (~> 2.2)
241235
rails-html-sanitizer (~> 1.6)
242-
actiontext (7.1.5.1)
243-
actionpack (= 7.1.5.1)
244-
activerecord (= 7.1.5.1)
245-
activestorage (= 7.1.5.1)
246-
activesupport (= 7.1.5.1)
236+
useragent (~> 0.16)
237+
actiontext (7.2.2.1)
238+
actionpack (= 7.2.2.1)
239+
activerecord (= 7.2.2.1)
240+
activestorage (= 7.2.2.1)
241+
activesupport (= 7.2.2.1)
247242
globalid (>= 0.6.0)
248243
nokogiri (>= 1.8.5)
249-
actionview (7.1.5.1)
250-
activesupport (= 7.1.5.1)
244+
actionview (7.2.2.1)
245+
activesupport (= 7.2.2.1)
251246
builder (~> 3.1)
252247
erubi (~> 1.11)
253248
rails-dom-testing (~> 2.2)
254249
rails-html-sanitizer (~> 1.6)
255250
active_link_to (1.0.5)
256251
actionpack
257252
addressable
258-
activejob (7.1.5.1)
259-
activesupport (= 7.1.5.1)
253+
activejob (7.2.2.1)
254+
activesupport (= 7.2.2.1)
260255
globalid (>= 0.3.6)
261-
activemodel (7.1.5.1)
262-
activesupport (= 7.1.5.1)
263-
activerecord (7.1.5.1)
264-
activemodel (= 7.1.5.1)
265-
activesupport (= 7.1.5.1)
256+
activemodel (7.2.2.1)
257+
activesupport (= 7.2.2.1)
258+
activerecord (7.2.2.1)
259+
activemodel (= 7.2.2.1)
260+
activesupport (= 7.2.2.1)
266261
timeout (>= 0.4.0)
267-
activestorage (7.1.5.1)
268-
actionpack (= 7.1.5.1)
269-
activejob (= 7.1.5.1)
270-
activerecord (= 7.1.5.1)
271-
activesupport (= 7.1.5.1)
262+
activestorage (7.2.2.1)
263+
actionpack (= 7.2.2.1)
264+
activejob (= 7.2.2.1)
265+
activerecord (= 7.2.2.1)
266+
activesupport (= 7.2.2.1)
272267
marcel (~> 1.0)
273-
activesupport (7.1.5.1)
268+
activesupport (7.2.2.1)
274269
base64
275270
benchmark (>= 0.3)
276271
bigdecimal
277-
concurrent-ruby (~> 1.0, >= 1.0.2)
272+
concurrent-ruby (~> 1.0, >= 1.3.1)
278273
connection_pool (>= 2.2.5)
279274
drb
280275
i18n (>= 1.6, < 2)
281276
logger (>= 1.4.2)
282277
minitest (>= 5.1)
283-
mutex_m
284278
securerandom (>= 0.3)
285-
tzinfo (~> 2.0)
279+
tzinfo (~> 2.0, >= 2.0.5)
286280
acts_as_list (1.2.4)
287281
activerecord (>= 6.1)
288282
activesupport (>= 6.1)
289283
addressable (2.8.7)
290284
public_suffix (>= 2.0.2, < 7.0)
291285
ast (2.4.2)
292-
base64 (0.2.0)
286+
base64 (0.3.0)
293287
batch-loader (2.0.5)
294288
bcrypt (3.1.20)
295-
benchmark (0.4.0)
289+
benchmark (0.4.1)
296290
better_html (2.1.1)
297291
actionview (>= 6.0)
298292
activesupport (>= 6.0)
299293
ast (~> 2.0)
300294
erubi (~> 1.4)
301295
parser (>= 2.4)
302296
smart_properties
303-
bigdecimal (3.1.9)
297+
bigdecimal (3.2.1)
304298
bindex (0.8.1)
305299
bootsnap (1.18.4)
306300
msgpack (~> 1.2)
@@ -516,7 +510,7 @@ GEM
516510
listen (3.9.0)
517511
rb-fsevent (~> 0.10, >= 0.10.3)
518512
rb-inotify (~> 0.9, >= 0.9.10)
519-
logger (1.6.5)
513+
logger (1.7.0)
520514
loofah (2.24.1)
521515
crass (~> 1.0.2)
522516
nokogiri (>= 1.12.0)
@@ -537,7 +531,6 @@ GEM
537531
msgpack (1.7.5)
538532
multi_xml (0.7.1)
539533
bigdecimal (~> 3.1)
540-
mutex_m (0.3.0)
541534
net-http (0.6.0)
542535
uri
543536
net-imap (0.5.8)
@@ -644,20 +637,20 @@ GEM
644637
rackup (1.0.1)
645638
rack (< 3)
646639
webrick
647-
rails (7.1.5.1)
648-
actioncable (= 7.1.5.1)
649-
actionmailbox (= 7.1.5.1)
650-
actionmailer (= 7.1.5.1)
651-
actionpack (= 7.1.5.1)
652-
actiontext (= 7.1.5.1)
653-
actionview (= 7.1.5.1)
654-
activejob (= 7.1.5.1)
655-
activemodel (= 7.1.5.1)
656-
activerecord (= 7.1.5.1)
657-
activestorage (= 7.1.5.1)
658-
activesupport (= 7.1.5.1)
640+
rails (7.2.2.1)
641+
actioncable (= 7.2.2.1)
642+
actionmailbox (= 7.2.2.1)
643+
actionmailer (= 7.2.2.1)
644+
actionpack (= 7.2.2.1)
645+
actiontext (= 7.2.2.1)
646+
actionview (= 7.2.2.1)
647+
activejob (= 7.2.2.1)
648+
activemodel (= 7.2.2.1)
649+
activerecord (= 7.2.2.1)
650+
activestorage (= 7.2.2.1)
651+
activesupport (= 7.2.2.1)
659652
bundler (>= 1.15.0)
660-
railties (= 7.1.5.1)
653+
railties (= 7.2.2.1)
661654
rails-controller-testing (1.0.5)
662655
actionpack (>= 5.0.1.rc1)
663656
actionview (>= 5.0.1.rc1)
@@ -672,16 +665,16 @@ GEM
672665
rails-i18n (7.0.10)
673666
i18n (>= 0.7, < 2)
674667
railties (>= 6.0.0, < 8)
675-
railties (7.1.5.1)
676-
actionpack (= 7.1.5.1)
677-
activesupport (= 7.1.5.1)
678-
irb
668+
railties (7.2.2.1)
669+
actionpack (= 7.2.2.1)
670+
activesupport (= 7.2.2.1)
671+
irb (~> 1.13)
679672
rackup (>= 1.0.0)
680673
rake (>= 12.2)
681674
thor (~> 1.0, >= 1.2.2)
682675
zeitwerk (~> 2.6)
683676
rainbow (3.1.1)
684-
rake (13.2.1)
677+
rake (13.3.0)
685678
ransack (4.2.1)
686679
activerecord (>= 6.1.5)
687680
activesupport (>= 6.1.5)
@@ -695,7 +688,7 @@ GEM
695688
redcarpet (3.6.0)
696689
redis (4.8.1)
697690
regexp_parser (2.10.0)
698-
reline (0.6.0)
691+
reline (0.6.1)
699692
io-console (~> 0.5)
700693
request_store (1.7.0)
701694
rack (>= 1.4)
@@ -832,6 +825,7 @@ GEM
832825
unicode-emoji (4.0.4)
833826
uniform_notifier (1.16.0)
834827
uri (1.0.2)
828+
useragent (0.16.11)
835829
valid_email2 (7.0.0)
836830
activemodel (>= 6.0)
837831
mail (~> 2.5)

decidim-blogs/spec/shared/manage_posts_examples.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
expect(page).to have_content("created the #{translated(attributes[:title])} blog post")
6565
end
6666

67+
perform_enqueued_jobs
68+
6769
visit decidim.last_activities_path
6870
expect(page).to have_content("New post: #{translated(attributes[:title])}")
6971

decidim-comments/app/models/decidim/comments/comment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def deleted?
208208
end
209209

210210
def edited?
211-
Decidim::ActionLog.where(resource: self).exists?(["extra @> ?", Arel.sql("{\"edit\":true}")])
211+
Decidim::ActionLog.where(resource: self).exists?(["extra @> ?", { edit: true }.to_json])
212212
end
213213

214214
def extra_actions_for(current_user)

decidim-core/app/commands/decidim/update_account.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def update_personal_data
5656

5757
def update_avatar
5858
if @form.avatar.present?
59-
current_user.avatar.attach(@form.avatar)
59+
current_user.avatar.attach(@form.avatar.signed_id)
6060
elsif @form.remove_avatar
6161
current_user.avatar = nil
6262
end

decidim-core/app/controllers/decidim/application_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def store_share_token
6868

6969
private
7070

71+
def allow_browser(**); end
72+
7173
# This overrides Devise's method for extracting the path from the URL. We
7274
# want to ensure the path to be stored in the cookie is not too long in
7375
# order to avoid ActionDispatch::Cookies::CookieOverflow exception. If the

decidim-core/app/models/decidim/taxonomy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Taxonomy < ApplicationRecord
5353
}
5454

5555
scope :part_of, lambda { |id|
56-
where("part_of @> ARRAY[?]", id.to_i)
56+
where("part_of @> ARRAY[?]::integer[]", id.to_i)
5757
}
5858

5959
def self.log_presenter_class_for(_log)

decidim-core/app/models/decidim/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def self.all
5757

5858
scope :org_admins_except_me, ->(user) { where(organization: user.organization, admin: true).where.not(id: user.id) }
5959

60-
scope :ephemeral, -> { where("extended_data @> ?", Arel.sql({ ephemeral: true }.to_json)) }
60+
scope :ephemeral, -> { where("extended_data @> ?", { ephemeral: true }.to_json) }
6161

6262
scope :with_inactivity_notification, lambda {
6363
where("extended_data ? 'inactivity_notification'")

decidim-core/decidim-core.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Gem::Specification.new do |s|
7373
s.add_dependency "premailer-rails", "~> 1.10"
7474
s.add_dependency "rack", "~> 2.2", ">= 2.2.8.1"
7575
s.add_dependency "rack-attack", "~> 6.0"
76-
s.add_dependency "rails", "~> 7.1.0"
76+
s.add_dependency "rails", "~> 7.2.0"
7777
s.add_dependency "rails-i18n", "~> 7.0"
7878
s.add_dependency "ransack", "~> 4.2.0"
7979
s.add_dependency "redis", "~> 4.1"

decidim-core/lib/decidim/api/input_filters/component_input_filter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class ComponentInputFilter < BaseInputFilter
3535

3636
def self.prepare_comments_enabled(active, _ctx)
3737
lambda do |_model_name, _locale|
38-
["(settings->'global'->>'comments_enabled')::boolean is ?", active]
38+
["settings @> ?", { global: { comments_enabled: active } }.to_json]
3939
end
4040
end
4141

4242
def self.prepare_geolocation_enabled(active, _ctx)
4343
lambda do |_model_name, _locale|
44-
["(settings->'global'->>'geocoding_enabled')::boolean is ? or manifest_name='meetings'", active]
44+
["settings @> ? or manifest_name='meetings'", { global: { geocoding_enabled: active } }.to_json]
4545
end
4646
end
4747

decidim-core/lib/decidim/attributes/time_with_zone.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def cast_value(value)
3333
return fallback unless fallback.is_a?(Time)
3434
return Time.zone.parse(fallback.strftime("%F %T")) if ISO_DATETIME_WITHOUT_TIMEZONE.match?(value)
3535

36-
ActiveSupport::TimeWithZone.new(fallback, Time.zone)
36+
fallback
3737
end
3838
end
3939
end

0 commit comments

Comments
 (0)