decidim-core 0.30.2 → 0.30.4

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/activity_cell.rb +6 -0
  3. data/app/cells/decidim/author/badge.erb +6 -0
  4. data/app/cells/decidim/author/show.erb +5 -1
  5. data/app/cells/decidim/author_cell.rb +10 -0
  6. data/app/cells/decidim/profile/avatar.erb +0 -2
  7. data/app/cells/decidim/profile/badge.erb +3 -3
  8. data/app/cells/decidim/profile/details.erb +2 -1
  9. data/app/cells/decidim/user_activity_cell.rb +6 -1
  10. data/app/controllers/decidim/download_your_data_controller.rb +5 -2
  11. data/app/forms/decidim/user_group_form.rb +2 -0
  12. data/app/helpers/decidim/map_helper.rb +1 -1
  13. data/app/helpers/decidim/menu_helper.rb +8 -2
  14. data/app/models/decidim/private_export.rb +4 -0
  15. data/app/packs/src/decidim/form_filter.js +6 -0
  16. data/app/packs/src/decidim/map/controller/markers.js +3 -1
  17. data/app/packs/stylesheets/decidim/_author.scss +8 -0
  18. data/app/packs/stylesheets/decidim/_cards.scss +5 -1
  19. data/app/packs/stylesheets/decidim/_footer.scss +5 -0
  20. data/app/packs/stylesheets/decidim/_profile.scss +6 -6
  21. data/app/packs/stylesheets/decidim/editor.scss +3 -1
  22. data/app/services/decidim/download_your_data_exporter.rb +15 -4
  23. data/app/services/decidim/open_data_exporter.rb +2 -1
  24. data/app/validators/etiquette_validator.rb +2 -2
  25. data/app/validators/password_validator.rb +3 -1
  26. data/app/views/decidim/application/_document.html.erb +2 -2
  27. data/app/views/decidim/download_your_data/_export.html.erb +1 -1
  28. data/app/views/decidim/export_mailer/download_your_data_export.html.erb +1 -1
  29. data/app/views/decidim/export_mailer/export.html.erb +1 -1
  30. data/app/views/decidim/shared/_filters.html.erb +1 -1
  31. data/app/views/layouts/decidim/_application.html.erb +1 -1
  32. data/config/locales/ca-IT.yml +12 -10
  33. data/config/locales/ca.yml +10 -8
  34. data/config/locales/cs.yml +5 -0
  35. data/config/locales/de.yml +2 -1
  36. data/config/locales/en.yml +2 -0
  37. data/config/locales/es-MX.yml +2 -0
  38. data/config/locales/es-PY.yml +2 -0
  39. data/config/locales/es.yml +2 -0
  40. data/config/locales/eu.yml +49 -47
  41. data/config/locales/fi-plain.yml +1 -0
  42. data/config/locales/fi.yml +1 -0
  43. data/config/locales/fr-CA.yml +3 -1
  44. data/config/locales/fr.yml +3 -1
  45. data/config/locales/it.yml +2 -0
  46. data/config/locales/ja.yml +3 -0
  47. data/config/locales/ru.yml +0 -1
  48. data/config/locales/sl.yml +0 -1
  49. data/db/migrate/20250819110800_convert_private_exports_id_to_uuid.rb +55 -0
  50. data/lib/decidim/asset_router/storage.rb +8 -8
  51. data/lib/decidim/core/engine.rb +1 -0
  52. data/lib/decidim/core/test/factories.rb +7 -2
  53. data/lib/decidim/core/test/shared_examples/comments_examples.rb +24 -0
  54. data/lib/decidim/core/version.rb +1 -1
  55. data/lib/decidim/form_builder.rb +1 -1
  56. data/lib/decidim/webpacker/configuration.rb +5 -1
  57. data/lib/tasks/upgrade/clean.rake +11 -0
  58. data/lib/tasks/upgrade/decidim_fix_action_log.rake +28 -0
  59. metadata +9 -6
@@ -44,20 +44,20 @@ module Decidim
44
44
  # @param options The options for the URL that are the normal route options
45
45
  # Rails route helpers accept
46
46
  # @return [String] The URL of the asset
47
- def url(**)
47
+ def url(**options)
48
48
  case asset
49
49
  when ActiveStorage::Attached
50
- ensure_current_host(asset.record, **)
51
- blob_url(**)
50
+ ensure_current_host(asset.record, **options)
51
+ blob_url(**options.except(:host))
52
52
  when ActiveStorage::Blob
53
- blob_url(**)
53
+ blob_url(**options)
54
54
  else # ActiveStorage::VariantWithRecord, ActiveStorage::Variant
55
55
  if blob && blob.attachments.any?
56
- ensure_current_host(blob.attachments.first&.record, **)
57
- representation_url(**)
56
+ ensure_current_host(blob.attachments.first&.record, **options)
57
+ representation_url(**options.except(:host))
58
58
  else
59
- ensure_current_host(nil, **)
60
- representation_url(**, only_path: true)
59
+ ensure_current_host(nil, **options)
60
+ representation_url(**options.except(:host), only_path: true)
61
61
  end
62
62
  end
63
63
  end
@@ -459,6 +459,7 @@ module Decidim
459
459
  end
460
460
 
461
461
  initializer "decidim_core.add_cells_view_paths" do
462
+ Cell::ViewModel.view_paths << Rails.root.join("app/views") # for partials
462
463
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells")
463
464
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells/amendable")
464
465
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/views") # for partials
@@ -939,9 +939,14 @@ FactoryBot.define do
939
939
  end
940
940
  expires_at { 1.week.from_now }
941
941
  attached_to { create(:user, organization:, skip_injection:) }
942
- export_type { "dummy" }
942
+ export_type { "download_your_data" }
943
943
  content_type { "application/zip" }
944
- file_size { 10.kilobytes }
944
+ file_size { 208.bytes }
945
+ file { Decidim::Dev.test_file("dummy-export.zip", "application/zip") }
946
+
947
+ trait :expired do
948
+ expires_at { 1.week.ago }
949
+ end
945
950
  end
946
951
 
947
952
  factory :searchable_resource, class: "Decidim::SearchableResource" do
@@ -892,6 +892,30 @@ shared_examples "comments" do
892
892
  expect(page.find("#comment-#{parent.id}-replies").text).to be_blank
893
893
  end
894
894
  end
895
+
896
+ context "when admin moderates the comment" do
897
+ let!(:user) { create(:user, :admin, :confirmed, organization:) }
898
+
899
+ before do
900
+ switch_to_host(organization.host)
901
+ login_as user, scope: :user
902
+ visit resource_path
903
+ end
904
+
905
+ it "hides the comment" do
906
+ within "#comment_#{comments.first.id}" do
907
+ page.find("[id^='dropdown-trigger']").click
908
+ click_on "Report"
909
+ end
910
+
911
+ within "#flagModalComment#{comments.first.id}" do
912
+ check "Hide this content"
913
+ click_on "Hide"
914
+ end
915
+
916
+ expect(page).to have_content("This resource has been hidden.")
917
+ end
918
+ end
895
919
  end
896
920
 
897
921
  describe "arguable option" do
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-core version.
5
5
  module Core
6
6
  def self.version
7
- "0.30.2"
7
+ "0.30.4"
8
8
  end
9
9
  end
10
10
  end
@@ -230,7 +230,7 @@ module Decidim
230
230
  disabled: options[:disabled],
231
231
  options: editor_options[:editor]
232
232
  }
233
- ) { content_tag(:div, nil, class: "editor-input", style: "height: #{lines}rem") }
233
+ ) { content_tag(:div, nil, class: "editor-input", style: "min-height: #{lines}rem") }
234
234
  template += error_for(name, options) if error?(name)
235
235
  template += editor_upload(editor_image, editor_options[:upload])
236
236
  template.html_safe
@@ -64,7 +64,11 @@ module Decidim
64
64
  end
65
65
 
66
66
  def configuration_file_path
67
- @configuration_file_path ||= File.join(app_path, "tmp/webpacker_runtime.yml")
67
+ @configuration_file_path ||= if defined?(Rails) && Rails.env.test?
68
+ File.join(app_path, "tmp/webpacker_runtime#{ENV.fetch("TEST_ENV_NUMBER", "")}.yml")
69
+ else
70
+ File.join(app_path, "tmp/webpacker_runtime.yml")
71
+ end
68
72
  end
69
73
 
70
74
  def original_configuration_file_path
@@ -148,6 +148,17 @@ namespace :decidim do
148
148
  invalid_private_exports.delete_all
149
149
  end
150
150
 
151
+ desc "Remove invalid exports from ActiveStorage"
152
+ task remove_private_exports_attachments: :environment do
153
+ invalid = ActiveStorage::Attachment.where(record_type: "Decidim::PrivateExport", record_id: 0)
154
+ logger.info("=== Removing #{invalid.length} invalid PrivateExports attachments")
155
+ invalid.each(&:purge_later)
156
+
157
+ expired = Decidim::PrivateExport.where(expires_at: ..Time.zone.now).collect(&:file).compact_blank
158
+ logger.info("=== Removing #{expired.length} expired attachments from PrivateExports")
159
+ expired.each(&:purge_later) if expired.any?
160
+ end
161
+
151
162
  def logger
152
163
  @logger ||= Logger.new($stdout)
153
164
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :decidim do
4
+ namespace :upgrade do
5
+ desc "Fixes the visibility of menu_hidden action logs"
6
+ task :fix_action_log => :environment do
7
+ logger.info("Fixing action log menu_hidden actions...")
8
+
9
+ count = Decidim::ActionLog.where(action: "menu_hidden").where.not(visibility: "admin-only").count
10
+ logger.info "Found #{count} action logs to update."
11
+ if count.positive?
12
+ # ActionLog is a read-only model, so we need to use raw SQL to update the records
13
+ ActiveRecord::Base.connection.execute("UPDATE decidim_action_logs SET visibility = 'admin-only' WHERE action = 'menu_hidden'")
14
+ if Decidim::ActionLog.where(action: "menu_hidden").where.not(visibility: "admin-only").count.zero?
15
+ logger.info("Successfully updated #{count} action logs.")
16
+ else
17
+ logger.error("Failed to update all action logs. Please check the database.")
18
+ end
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def logger
25
+ @logger ||= Logger.new($stdout)
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.2
4
+ version: 0.30.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-09-23 00:00:00.000000000 Z
13
+ date: 2025-11-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: concurrent-ruby
@@ -780,28 +780,28 @@ dependencies:
780
780
  requirements:
781
781
  - - '='
782
782
  - !ruby/object:Gem::Version
783
- version: 0.30.2
783
+ version: 0.30.4
784
784
  type: :development
785
785
  prerelease: false
786
786
  version_requirements: !ruby/object:Gem::Requirement
787
787
  requirements:
788
788
  - - '='
789
789
  - !ruby/object:Gem::Version
790
- version: 0.30.2
790
+ version: 0.30.4
791
791
  - !ruby/object:Gem::Dependency
792
792
  name: decidim-dev
793
793
  requirement: !ruby/object:Gem::Requirement
794
794
  requirements:
795
795
  - - '='
796
796
  - !ruby/object:Gem::Version
797
- version: 0.30.2
797
+ version: 0.30.4
798
798
  type: :development
799
799
  prerelease: false
800
800
  version_requirements: !ruby/object:Gem::Requirement
801
801
  requirements:
802
802
  - - '='
803
803
  - !ruby/object:Gem::Version
804
- version: 0.30.2
804
+ version: 0.30.4
805
805
  description: Adds core features so other engines can hook into the framework.
806
806
  email:
807
807
  - josepjaume@gmail.com
@@ -838,6 +838,7 @@ files:
838
838
  - app/cells/decidim/attachments_link_tab_cell.rb
839
839
  - app/cells/decidim/author/avatar.erb
840
840
  - app/cells/decidim/author/avatar_image.erb
841
+ - app/cells/decidim/author/badge.erb
841
842
  - app/cells/decidim/author/cancelled_on.erb
842
843
  - app/cells/decidim/author/comments.erb
843
844
  - app/cells/decidim/author/contact.erb
@@ -2510,6 +2511,7 @@ files:
2510
2511
  - db/migrate/20241111104357_add_names_and_space_boolean_to_taxonomy_filters.rb
2511
2512
  - db/migrate/20241127093708_add_taxonomy_to_metrics.rb
2512
2513
  - db/migrate/20241204121445_add_participatory_space_manifests_from_taxonomy_filters.rb
2514
+ - db/migrate/20250819110800_convert_private_exports_id_to_uuid.rb
2513
2515
  - db/seeds.rb
2514
2516
  - db/seeds/Exampledocument.pdf
2515
2517
  - db/seeds/avatars/001.jpg
@@ -3086,6 +3088,7 @@ files:
3086
3088
  - lib/tasks/upgrade/decidim_attachments.rake
3087
3089
  - lib/tasks/upgrade/decidim_content_blocks_tasks.rake
3088
3090
  - lib/tasks/upgrade/decidim_deduplicate_endorsements.rake
3091
+ - lib/tasks/upgrade/decidim_fix_action_log.rake
3089
3092
  - lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake
3090
3093
  - lib/tasks/upgrade/decidim_fix_short_url_resolver.rake
3091
3094
  - lib/tasks/upgrade/decidim_migrate_wysiwyg_content.rake