decidim-core 0.27.4 → 0.27.5

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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/upload_modal/modal.erb +4 -1
  3. data/app/cells/decidim/upload_modal_cell.rb +8 -4
  4. data/app/cells/decidim/version_cell.rb +1 -1
  5. data/app/cells/decidim/versions_list_cell.rb +1 -1
  6. data/app/commands/decidim/endorse_resource.rb +2 -0
  7. data/app/commands/decidim/search.rb +1 -1
  8. data/app/commands/decidim/unendorse_resource.rb +1 -1
  9. data/app/controllers/concerns/decidim/force_authentication.rb +6 -2
  10. data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
  11. data/app/controllers/decidim/links_controller.rb +1 -1
  12. data/app/controllers/decidim/searches_controller.rb +1 -1
  13. data/app/controllers/decidim/user_timeline_controller.rb +1 -1
  14. data/app/forms/decidim/account_form.rb +1 -1
  15. data/app/forms/decidim/notifications_settings_form.rb +0 -8
  16. data/app/forms/decidim/registration_form.rb +1 -1
  17. data/app/helpers/decidim/decidim_form_helper.rb +1 -0
  18. data/app/helpers/decidim/omniauth_helper.rb +2 -0
  19. data/app/helpers/decidim/resource_helper.rb +2 -0
  20. data/app/helpers/decidim/short_link_helper.rb +1 -1
  21. data/app/jobs/decidim/download_your_data_export_job.rb +2 -1
  22. data/app/jobs/decidim/open_data_job.rb +2 -0
  23. data/app/models/decidim/user.rb +9 -1
  24. data/app/packs/images/decidim/icons.svg +1 -1
  25. data/app/packs/images/decidim/vendor/social-share-button/x.svg +6 -0
  26. data/app/packs/src/decidim/autocomplete.js +11 -2
  27. data/app/packs/src/decidim/data_picker.js +1 -0
  28. data/app/packs/src/decidim/direct_uploads/upload_field.js +6 -4
  29. data/app/packs/src/decidim/direct_uploads/upload_modal.js +10 -8
  30. data/app/packs/src/decidim/direct_uploads/uploader.js +4 -1
  31. data/app/packs/src/decidim/geocoding/attach_input.js +4 -1
  32. data/app/packs/src/decidim/geocoding/provider/here.js +17 -21
  33. data/app/packs/src/decidim/geocoding/provider/photon.js +1 -1
  34. data/app/packs/src/decidim/utilities/text.js +17 -0
  35. data/app/packs/stylesheets/decidim/_variables.scss +1 -1
  36. data/app/packs/stylesheets/decidim/vendor/_social_share_button.scss +4 -0
  37. data/app/views/decidim/notifications_settings/show.html.erb +1 -1
  38. data/app/views/decidim/scopes/_scopes_picker_input.html.erb +1 -1
  39. data/app/views/decidim/searches/_filters.html.erb +3 -1
  40. data/app/views/decidim/shared/_share_modal.html.erb +1 -1
  41. data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +1 -1
  42. data/app/views/layouts/decidim/_social_media_links.html.erb +2 -2
  43. data/config/environment.rb +3 -0
  44. data/config/locales/ar.yml +8 -14
  45. data/config/locales/bg.yml +4 -16
  46. data/config/locales/ca.yml +12 -8
  47. data/config/locales/cs.yml +18 -14
  48. data/config/locales/de.yml +39 -35
  49. data/config/locales/el.yml +10 -13
  50. data/config/locales/en.yml +5 -1
  51. data/config/locales/eo.yml +2 -3
  52. data/config/locales/es-MX.yml +14 -10
  53. data/config/locales/es-PY.yml +14 -10
  54. data/config/locales/es.yml +10 -6
  55. data/config/locales/eu.yml +491 -342
  56. data/config/locales/fi-plain.yml +7 -3
  57. data/config/locales/fi.yml +18 -14
  58. data/config/locales/fr-CA.yml +15 -11
  59. data/config/locales/fr.yml +10 -6
  60. data/config/locales/ga-IE.yml +5 -5
  61. data/config/locales/gl.yml +2 -19
  62. data/config/locales/hu.yml +23 -16
  63. data/config/locales/id-ID.yml +4 -19
  64. data/config/locales/is-IS.yml +4 -2
  65. data/config/locales/it.yml +14 -14
  66. data/config/locales/ja.yml +23 -20
  67. data/config/locales/lb.yml +14 -14
  68. data/config/locales/lt.yml +56 -8
  69. data/config/locales/lv.yml +4 -16
  70. data/config/locales/nl.yml +12 -12
  71. data/config/locales/no.yml +7 -7
  72. data/config/locales/pl.yml +20 -6
  73. data/config/locales/pt-BR.yml +159 -6
  74. data/config/locales/pt.yml +7 -7
  75. data/config/locales/ro-RO.yml +4 -7
  76. data/config/locales/ru.yml +4 -17
  77. data/config/locales/sk.yml +5 -17
  78. data/config/locales/sl.yml +0 -5
  79. data/config/locales/sq-AL.yml +1 -0
  80. data/config/locales/sv.yml +33 -15
  81. data/config/locales/th-TH.yml +1 -0
  82. data/config/locales/tr-TR.yml +17 -12
  83. data/config/locales/uk.yml +3 -14
  84. data/config/locales/zh-CN.yml +6 -7
  85. data/config/locales/zh-TW.yml +0 -6
  86. data/db/migrate/20231027142329_change_default_value_for_decidim_endorsements.rb +11 -0
  87. data/db/seeds.rb +1 -0
  88. data/lib/decidim/core/test/factories.rb +2 -1
  89. data/lib/decidim/core/test/shared_examples/comments_examples.rb +24 -0
  90. data/lib/decidim/core/test/shared_examples/errors.rb +2 -0
  91. data/lib/decidim/core/version.rb +1 -1
  92. data/lib/decidim/core.rb +1 -1
  93. data/lib/decidim/endorsable.rb +1 -1
  94. data/lib/decidim/exporters.rb +10 -1
  95. data/lib/decidim/form_builder.rb +1 -0
  96. data/lib/decidim/has_category.rb +2 -2
  97. data/lib/tasks/upgrade/decidim_deduplicate_endorsements.rake +53 -0
  98. data/lib/tasks/upgrade/decidim_fix_short_url_resolver.rake +22 -0
  99. metadata +14 -10
  100. data/app/helpers/decidim/layout_helper.rb.orig +0 -225
  101. data/app/packs/stylesheets/decidim/modules/_dropdown_menu.scss +0 -9
  102. data/app/views/decidim/devise/registrations/new.html.erb.orig +0 -231
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d976829c2218ab34a1bf7c2ad99443edd61c4f37bb56963c8bb21a3e74afddef
4
- data.tar.gz: acbaa2ce577af7e32648ce22941616e258f48bdbfb304e754344770fafaf9ef4
3
+ metadata.gz: c9b09dc6caf48cd1318acfd39efaef6e9aa95ed3527ff40c3974a56f409eeff7
4
+ data.tar.gz: bb6ca8ea6d9b57a37d6793757cd8a12bbcffdf63afd27924216f67af1d8acb14
5
5
  SHA512:
6
- metadata.gz: 868d324e0f83442b37750933c39985dffdba9bfd06a2f47ad00836b7c9b89164bafff5d2083d5e24d7f01eb9c47dac46f564a375bacaa17726fe5d472bf6c86b
7
- data.tar.gz: 1af449d8a281aa2ae5db6c0f03a7be077f7a7eeaa2a300e8bc2a2d36622cd4be5aafb4245878a24e4bd2496542d0166a84287974e72cdeb294acdcd021144b00
6
+ metadata.gz: 4003252d8eeae3f86cb4056380f4fb7aefe8a8e97f3935e97a970513ccdd05e9d6b9ca8658b56147b7bff0e306608472e656db871eae5bbb50ab9cfc1e629d4b
7
+ data.tar.gz: ce5aec4bd84ee34b87b5b7cc3f1afb08a1e6bcc3c34ff5cf1afa87d3ded13fe012f29a6a882fead250413f64db4a9b643770ca2c0e643e186ea51bb57a2e6c87
@@ -35,7 +35,10 @@
35
35
  label: false,
36
36
  multiple: true,
37
37
  direct_upload: true,
38
- data: { direct_upload_url: direct_upload_url } %>
38
+ data: {
39
+ direct_upload_url: direct_upload_url,
40
+ upload_validations_url: upload_validations_url
41
+ } %>
39
42
  <span><%= t("decidim.forms.upload_help.dropzone") %></span>
40
43
  </label>
41
44
  </div>
@@ -156,15 +156,15 @@ module Decidim
156
156
  end
157
157
 
158
158
  def truncated_file_name_for(attachment, max_length = 31)
159
- filename = file_name_for(attachment)
160
- return filename if filename.length <= max_length
159
+ filename = determine_filename(attachment)
160
+ return decidim_html_escape(filename).html_safe if filename.length <= max_length
161
161
 
162
162
  name = File.basename(filename, File.extname(filename))
163
- name.truncate(max_length, omission: "...#{name.last((max_length / 2) - 3)}#{File.extname(filename)}")
163
+ decidim_html_escape(name.truncate(max_length, omission: "...#{name.last((max_length / 2) - 3)}#{File.extname(filename)}")).html_safe
164
164
  end
165
165
 
166
166
  def file_name_for(attachment)
167
- determine_filename(attachment)
167
+ decidim_html_escape(determine_filename(attachment)).html_safe
168
168
  end
169
169
 
170
170
  def determine_filename(attachment)
@@ -205,6 +205,10 @@ module Decidim
205
205
  Rails.application.class.routes.url_helpers.rails_direct_uploads_path
206
206
  end
207
207
 
208
+ def upload_validations_url
209
+ Decidim::Core::Engine.routes.url_helpers.upload_validations_path
210
+ end
211
+
208
212
  def form_object_class
209
213
  form.object.class.to_s
210
214
  end
@@ -66,7 +66,7 @@ module Decidim
66
66
  end
67
67
 
68
68
  def resource_path
69
- resource_locator(versioned_resource).path
69
+ Decidim::ResourceLocatorPresenter.new(versioned_resource).path
70
70
  end
71
71
  end
72
72
  end
@@ -13,7 +13,7 @@ module Decidim
13
13
  end
14
14
 
15
15
  def resource_path
16
- resource_locator(versioned_resource).path
16
+ Decidim::ResourceLocatorPresenter.new(versioned_resource).path
17
17
  end
18
18
 
19
19
  def i18n_changes_title
@@ -31,6 +31,8 @@ module Decidim
31
31
  else
32
32
  broadcast(:invalid)
33
33
  end
34
+ rescue ActiveRecord::RecordNotUnique
35
+ broadcast(:invalid)
34
36
  end
35
37
 
36
38
  private
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  # A command that will act as a search service, with all the business logic for performing searches.
5
5
  class Search < Decidim::Command
6
- ACCEPTED_FILTERS = [:decidim_scope_id_eq].freeze
6
+ ACCEPTED_FILTERS = [:decidim_scope_id_in].freeze
7
7
  HIGHLIGHTED_RESULTS_COUNT = 4
8
8
 
9
9
  # Public: Initializes the command.
@@ -31,7 +31,7 @@ module Decidim
31
31
  query = if @current_group.present?
32
32
  @resource.endorsements.where(decidim_user_group_id: @current_group&.id)
33
33
  else
34
- @resource.endorsements.where(author: @current_user, decidim_user_group_id: nil)
34
+ @resource.endorsements.where(author: @current_user, decidim_user_group_id: 0)
35
35
  end
36
36
  query.destroy_all
37
37
  end
@@ -35,11 +35,15 @@ module Decidim
35
35
  end
36
36
 
37
37
  def unauthorized_paths
38
- # /locale is for changing the locale
39
- %w(/locale) + Decidim::StaticPage.where(
38
+ default_unauthorized_paths + Decidim::StaticPage.where(
40
39
  organization: current_organization,
41
40
  allow_public_access: true
42
41
  ).pluck(Arel.sql("CONCAT('/pages/', slug)"))
43
42
  end
43
+
44
+ def default_unauthorized_paths
45
+ # /locale is for changing the locale and /manifest.webmanifest to request PWA manifest
46
+ %w(/locale /manifest.webmanifest)
47
+ end
44
48
  end
45
49
  end
@@ -39,7 +39,7 @@ module Decidim
39
39
  end
40
40
 
41
41
  on(:invalid) do
42
- flash.now[:alert] = @form.errors.full_messages.join(", ") if @form.errors.full_messages.any?
42
+ flash.now[:alert] = t("error", scope: "decidim.devise.registrations.create")
43
43
  render :new
44
44
  end
45
45
  end
@@ -35,7 +35,7 @@ module Decidim
35
35
  end
36
36
 
37
37
  def external_url
38
- @external_url ||= URI.parse(params[:external_url])
38
+ @external_url ||= URI.parse(URI::Parser.new.escape(params[:external_url]))
39
39
  end
40
40
  end
41
41
  end
@@ -26,7 +26,7 @@ module Decidim
26
26
  term: params[:term],
27
27
  with_resource_type: nil,
28
28
  with_space_state: nil,
29
- decidim_scope_id_eq: nil
29
+ decidim_scope_id_in: nil
30
30
  }
31
31
  end
32
32
 
@@ -12,7 +12,7 @@ module Decidim
12
12
  helper_method :activities, :resource_types, :user
13
13
 
14
14
  def index
15
- raise ActionController::RoutingError, "Not Found" if current_user != user
15
+ raise ActionController::RoutingError, "Not Found" unless user && current_user == user
16
16
  end
17
17
 
18
18
  private
@@ -24,7 +24,7 @@ module Decidim
24
24
  validates :nickname, presence: true, format: { with: Decidim::User::REGEXP_NICKNAME }
25
25
 
26
26
  validates :nickname, length: { maximum: Decidim::User.nickname_max_length, allow_blank: true }
27
- validates :password, confirmation: true
27
+ validates :password, confirmation: { message: I18n.t("errors.messages.password_confirmation_message") }
28
28
  validates :password, password: { name: :name, email: :email, username: :nickname }, if: -> { password.present? }
29
29
  validates :password_confirmation, presence: true, if: :password_present
30
30
  validates :avatar, passthru: { to: Decidim::User }
@@ -44,14 +44,6 @@ module Decidim
44
44
  allow_public_contact ? "all" : "followed-only"
45
45
  end
46
46
 
47
- def user_is_moderator?(user)
48
- Decidim.participatory_space_manifests.map do |manifest|
49
- participatory_space_type = manifest.model_class_name.constantize
50
- return true if participatory_space_type.moderators(user.organization).exists?(id: user.id)
51
- end
52
- false
53
- end
54
-
55
47
  def meet_push_notifications_requirements?
56
48
  Rails.application.secrets.dig(:vapid, :enabled) || false
57
49
  end
@@ -17,7 +17,7 @@ module Decidim
17
17
  validates :name, presence: true, format: { with: Decidim::User::REGEXP_NAME }
18
18
  validates :nickname, presence: true, format: { with: Decidim::User::REGEXP_NICKNAME }, length: { maximum: Decidim::User.nickname_max_length }
19
19
  validates :email, presence: true, "valid_email_2/email": { disposable: true }
20
- validates :password, confirmation: true
20
+ validates :password, confirmation: { message: I18n.t("errors.messages.password_confirmation_message") }
21
21
  validates :password, password: { name: :name, email: :email, username: :nickname }
22
22
  validates :password_confirmation, presence: true
23
23
  validates :tos_agreement, allow_nil: false, acceptance: true
@@ -84,6 +84,7 @@ module Decidim
84
84
 
85
85
  template = ""
86
86
  template += render("decidim/scopes/scopes_picker_input",
87
+ values_options: { delete_button: false },
87
88
  picker_options: picker_options,
88
89
  prompt_params: prompt_params,
89
90
  scopes: scopes,
@@ -6,6 +6,8 @@ module Decidim
6
6
  # Public: normalize providers names to they can be used for buttons
7
7
  # and icons.
8
8
  def normalize_provider_name(provider)
9
+ return "x" if provider == :twitter
10
+
9
11
  provider.to_s.split("_").first
10
12
  end
11
13
 
@@ -67,6 +67,8 @@ module Decidim
67
67
 
68
68
  # Returns an instance of ResourceLocatorPresenter with the given resource
69
69
  def resource_locator(resource)
70
+ return resource.resource_locator if resource.respond_to?(:resource_locator)
71
+
70
72
  ::Decidim::ResourceLocatorPresenter.new(resource)
71
73
  end
72
74
 
@@ -21,7 +21,7 @@ module Decidim
21
21
  target ||= respond_to?(:current_organization) && current_organization
22
22
  target ||= Rails.application
23
23
 
24
- mounted_engine = EngineResolver.new(_routes).mounted_name
24
+ mounted_engine = target.try(:mounted_engine) || EngineResolver.new(_routes).mounted_name
25
25
  ShortLink.to(target, mounted_engine, **kwargs).short_url
26
26
  end
27
27
  end
@@ -11,7 +11,8 @@ module Decidim
11
11
 
12
12
  generate_zip_file(user, path, password, export_format)
13
13
  save_or_upload_file(user, path)
14
-
14
+ # Deletes temporary file
15
+ File.delete(path)
15
16
  ExportMailer.download_your_data_export(user, filename, password).deliver_later
16
17
  end
17
18
 
@@ -11,6 +11,8 @@ module Decidim
11
11
  raise "Couldn't generate Open Data export" unless exporter.export.positive?
12
12
 
13
13
  organization.open_data_file.attach(io: File.open(path, "rb"), filename: organization.open_data_file_path)
14
+ # Deletes the temporary file file
15
+ File.delete(path)
14
16
  end
15
17
  end
16
18
  end
@@ -205,7 +205,7 @@ module Decidim
205
205
  end
206
206
 
207
207
  def admin_terms_accepted?
208
- return true if admin_terms_accepted_at
208
+ admin_terms_accepted_at.present?
209
209
  end
210
210
 
211
211
  # Whether this user can be verified against some authorization or not.
@@ -269,6 +269,14 @@ module Decidim
269
269
  password_updated_at < Decidim.config.admin_password_expiration_days.days.ago
270
270
  end
271
271
 
272
+ def moderator?
273
+ Decidim.participatory_space_manifests.map do |manifest|
274
+ participatory_space_type = manifest.model_class_name.constantize
275
+ return true if participatory_space_type.moderators(organization).exists?(id: id)
276
+ end
277
+ false
278
+ end
279
+
272
280
  protected
273
281
 
274
282
  # Overrides devise email required validation.