decidim-core 0.27.1 → 0.27.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-core might be problematic. Click here for more details.

Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/newsletter_templates/base_cell.rb +8 -0
  3. data/app/cells/decidim/newsletter_templates/basic_only_text/show.erb +4 -4
  4. data/app/cells/decidim/newsletter_templates/image_text_cta/show.erb +4 -4
  5. data/app/cells/decidim/upload_modal_cell.rb +12 -7
  6. data/app/commands/decidim/unendorse_resource.rb +1 -1
  7. data/app/controllers/decidim/groups_controller.rb +5 -0
  8. data/app/controllers/decidim/links_controller.rb +4 -2
  9. data/app/controllers/decidim/profiles_controller.rb +1 -1
  10. data/app/helpers/decidim/icon_helper.rb +3 -3
  11. data/app/helpers/decidim/newsletters_helper.rb +1 -0
  12. data/app/mailers/decidim/newsletter_mailer.rb +10 -3
  13. data/app/models/decidim/newsletter.rb +28 -0
  14. data/app/models/decidim/user.rb +0 -2
  15. data/app/models/decidim/user_base_entity.rb +2 -0
  16. data/app/models/decidim/user_block.rb +2 -2
  17. data/app/models/decidim/user_group.rb +1 -1
  18. data/app/packs/src/decidim/form_filter.component.test.js +148 -5
  19. data/app/packs/src/decidim/form_filter.js +26 -4
  20. data/app/packs/stylesheets/decidim/email.scss +7 -0
  21. data/app/presenters/decidim/admin_log/user_group_presenter.rb +1 -1
  22. data/app/presenters/decidim/admin_log/user_moderation_presenter.rb +1 -1
  23. data/app/presenters/decidim/push_notification_presenter.rb +1 -1
  24. data/app/uploaders/decidim/application_uploader.rb +1 -1
  25. data/app/uploaders/decidim/avatar_uploader.rb +2 -2
  26. data/app/views/decidim/messaging/conversations/_conversation.html.erb +1 -1
  27. data/app/views/decidim/newsletter_mailer/newsletter.html.erb +3 -3
  28. data/app/views/decidim/newsletters/show.html.erb +1 -1
  29. data/app/views/layouts/decidim/_mailer_logo.html.erb +2 -2
  30. data/app/views/layouts/decidim/newsletter_base.html.erb +2 -2
  31. data/config/locales/ar.yml +5 -4
  32. data/config/locales/bg.yml +5 -4
  33. data/config/locales/ca.yml +17 -13
  34. data/config/locales/cs.yml +6 -3
  35. data/config/locales/de.yml +2 -5
  36. data/config/locales/el.yml +4 -5
  37. data/config/locales/en.yml +6 -2
  38. data/config/locales/es-MX.yml +10 -6
  39. data/config/locales/es-PY.yml +10 -6
  40. data/config/locales/es.yml +15 -11
  41. data/config/locales/eu.yml +24 -22
  42. data/config/locales/fi-plain.yml +6 -2
  43. data/config/locales/fi.yml +7 -3
  44. data/config/locales/fr-CA.yml +6 -5
  45. data/config/locales/fr.yml +6 -5
  46. data/config/locales/gl.yml +2 -4
  47. data/config/locales/hu.yml +4 -5
  48. data/config/locales/id-ID.yml +5 -4
  49. data/config/locales/is-IS.yml +0 -1
  50. data/config/locales/it.yml +1 -5
  51. data/config/locales/ja.yml +20 -16
  52. data/config/locales/ka-GE.yml +1 -0
  53. data/config/locales/lb.yml +0 -4
  54. data/config/locales/lt.yml +0 -4
  55. data/config/locales/lv.yml +5 -4
  56. data/config/locales/nl.yml +0 -4
  57. data/config/locales/no.yml +2 -6
  58. data/config/locales/pl.yml +4 -5
  59. data/config/locales/pt-BR.yml +0 -4
  60. data/config/locales/pt.yml +0 -4
  61. data/config/locales/ro-RO.yml +49 -3
  62. data/config/locales/ru.yml +5 -1
  63. data/config/locales/sk.yml +5 -4
  64. data/config/locales/sv.yml +22 -5
  65. data/config/locales/tr-TR.yml +4 -5
  66. data/config/locales/uk.yml +5 -1
  67. data/config/locales/zh-CN.yml +3 -4
  68. data/lib/decidim/api/types/localized_string_type.rb +9 -0
  69. data/lib/decidim/api/types/translated_field_type.rb +20 -5
  70. data/lib/decidim/asset_router/pipeline.rb +93 -0
  71. data/lib/decidim/asset_router/storage.rb +82 -0
  72. data/lib/decidim/asset_router.rb +3 -75
  73. data/lib/decidim/attribute_object/form.rb +9 -0
  74. data/lib/decidim/core/test/factories.rb +13 -6
  75. data/lib/decidim/core/version.rb +1 -1
  76. data/lib/decidim/dependency_resolver.rb +14 -8
  77. data/lib/decidim/form_builder.rb +1 -1
  78. data/lib/decidim/participatory_space_resourceable.rb +7 -1
  79. metadata +10 -7
@@ -322,7 +322,7 @@ tr:
322
322
  request_confirmation_instructions: Onaylama talimatlarını tekrar gönder
323
323
  title: E-posta adresinizi doğrulayın
324
324
  show:
325
- close_modal: Pencereyi kapat
325
+ close_modal: Yakın kalıcı
326
326
  block_user_mailer:
327
327
  notify:
328
328
  body_1: Hesabınız kilitlendi.
@@ -825,6 +825,9 @@ tr:
825
825
  index:
826
826
  last_activity: Son Aktivite
827
827
  resource_type: Türü
828
+ links:
829
+ warning:
830
+ close_modal: Yakın kalıcı
828
831
  log:
829
832
  base_presenter:
830
833
  create: "%{user_name}, %{resource_name} oluşturdu"
@@ -951,7 +954,6 @@ tr:
951
954
  newsletter_mailer:
952
955
  newsletter:
953
956
  note: Bu e-postayı, %{organization_name} bültenlere abone olduğunuz için aldınız. Eğer ayarlarınızı değiştirebilirsiniz <a href="%{link}">bildirimleri sayfa</a>.
954
- see_on_website: Bu e-postayı doğru göremiyor musunuz? Onu <a href="%{link}" target="_blank">web sitesinde görüntüle</a>.
955
957
  unsubscribe: Bu tür bir e-posta almayı iptal etmek için, <a href="%{link}" target="_blank" class="unsubscribe">Abonelikten Ayrıl</a>.
956
958
  newsletter_templates:
957
959
  basic_only_text:
@@ -1239,9 +1241,6 @@ tr:
1239
1241
  help_text: "<strong> Uyarı: </strong> İçerik otomatik olarak çevrilebilir ve %100 doğru olmayabilir."
1240
1242
  show_original: Orijinal metni göster
1241
1243
  show_translated: Otomatik olarak çevrilmiş metni göster
1242
- user_activity:
1243
- index:
1244
- no_activities_warning: Bu kullanıcının henüz herhangi bir etkinliği olmadı.
1245
1244
  user_contact_disabled: Bu katılımcı doğrudan mesajları kabul etmiyor.
1246
1245
  user_conversations:
1247
1246
  create:
@@ -171,6 +171,8 @@ uk:
171
171
  invalid_field: "Для поля %{field} значення %{value} неприпустиме."
172
172
  ok: Гаразд
173
173
  title: Недостатньо прав через відсутність підтвердження особи
174
+ show:
175
+ close_modal: Закрити віконце
174
176
  collapsible_list:
175
177
  see_less: "(читати менше)"
176
178
  see_more: "(читати далі)"
@@ -339,6 +341,9 @@ uk:
339
341
  default_image: Зображення за замовчуванням
340
342
  errors:
341
343
  error: У цьому полі є помилка.
344
+ links:
345
+ warning:
346
+ close_modal: Закрити віконце
342
347
  log:
343
348
  base_presenter:
344
349
  create: "%{user_name} створив %{resource_name}"
@@ -387,7 +392,6 @@ uk:
387
392
  newsletter_mailer:
388
393
  newsletter:
389
394
  note: Ви отримали цього електронного листа, оскільки ви підписалися на новини щодо %{organization_name}. Ви можете змінити свої налаштування на <a href="%{link}">сторінці сповіщень</a>.
390
- see_on_website: Не вдається до пуття переглянути це повідомлення? Перегляньте його на сайті <a href="%{link}" target="_blank"></a>.
391
395
  unsubscribe: Щоб відмовитися від отримання таких повідомлень, клацніть на <a href="%{link}" target="_blank" class="unsubscribe">Відмовитися</a>.
392
396
  newsletters:
393
397
  unsubscribe:
@@ -753,6 +753,9 @@ zh-CN:
753
753
  index:
754
754
  last_activity: 上次活动
755
755
  resource_type: 类型
756
+ links:
757
+ warning:
758
+ close_modal: 关闭模式
756
759
  log:
757
760
  base_presenter:
758
761
  create: "%{user_name} 创建了 %{resource_name}"
@@ -877,7 +880,6 @@ zh-CN:
877
880
  newsletter_mailer:
878
881
  newsletter:
879
882
  note: 您收到这封邮件是因为您订阅了 %{organization_name}的新闻通讯。您可以在您的 <a href="%{link}">通知页面</a> 更改您的设置。
880
- see_on_website: 找不到正确的电子邮件?在 <a href="%{link}" target="_blank">网站</a> 上查看。
881
883
  unsubscribe: 选择不接收这种类型的电子邮件, <a href="%{link}" target="_blank" class="unsubscribe">取消订阅</a>。
882
884
  newsletter_templates:
883
885
  basic_only_text:
@@ -1151,9 +1153,6 @@ zh-CN:
1151
1153
  help_text: "<strong>警告:</strong> 内容可能会被自动翻译而不是100%的准确性。"
1152
1154
  show_original: 显示原始文本
1153
1155
  show_translated: 显示自动翻译的文本
1154
- user_activity:
1155
- index:
1156
- no_activities_warning: 此参与者尚未有任何活动。
1157
1156
  user_contact_disabled: 此参与者不接受私信。
1158
1157
  user_conversations:
1159
1158
  create:
@@ -8,6 +8,15 @@ module Decidim
8
8
 
9
9
  field :locale, GraphQL::Types::String, "The standard locale of this translation.", null: false
10
10
  field :text, GraphQL::Types::String, "The content of this translation.", null: true
11
+ field :machine_translated, GraphQL::Types::Boolean, "Whether this string is machine translated or not.", null: false
12
+
13
+ def machine_translated
14
+ if object.respond_to?(:machine_translated)
15
+ object.machine_translated.present?
16
+ else
17
+ false
18
+ end
19
+ end
11
20
  end
12
21
  end
13
22
  end
@@ -17,19 +17,34 @@ module Decidim
17
17
  end
18
18
 
19
19
  def locales
20
- object.keys
20
+ (defined_translations.keys + machine_translations.keys).uniq
21
21
  end
22
22
 
23
23
  def translation(locale: "")
24
- translations = object.stringify_keys
25
- translations[locale]
24
+ display_translations[locale]
26
25
  end
27
26
 
28
27
  def translations(locales: [])
29
- translations = object.stringify_keys
28
+ translations = display_translations
30
29
  translations = translations.slice(*locales) unless locales.empty?
31
30
 
32
- translations.map { |locale, text| OpenStruct.new(locale: locale, text: text) }
31
+ translations.map { |locale, text| OpenStruct.new(locale: locale, text: text, machine_translated: defined_translations[locale].blank?) }
32
+ end
33
+
34
+ private
35
+
36
+ def display_translations
37
+ @display_translations ||= locales.index_with do |locale|
38
+ defined_translations[locale].presence || machine_translations[locale]
39
+ end
40
+ end
41
+
42
+ def defined_translations
43
+ object.stringify_keys.except("machine_translations")
44
+ end
45
+
46
+ def machine_translations
47
+ object.stringify_keys["machine_translations"]&.stringify_keys || {}
33
48
  end
34
49
  end
35
50
  end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module AssetRouter
5
+ # The pipeline asset router provides global access to the asset routers for
6
+ # assets that are precompiled through the Rails assets pipeline (or webpack)
7
+ # and stored locally or in a remote CDN. This handles the configuration
8
+ # options for the asset routes so that they don't have to be always manually
9
+ # created.
10
+ class Pipeline
11
+ # Initializes the router.
12
+ #
13
+ # @param asset [String] The asset to route to
14
+ # @param model [ActiveRecord::Base, nil] The model that provides the
15
+ # organizational context. When nil, the host will be included in the URL
16
+ # when it is available through other configurations. Otherwise, the host
17
+ # will not be part of the URL.
18
+ def initialize(asset, model: nil)
19
+ @asset = asset
20
+ @model = model
21
+ end
22
+
23
+ # Generates the correct URL to the asset with the provided options.
24
+ #
25
+ # @param options [Hash] The options for the URL that are the normal route
26
+ # options Rails route helpers accept
27
+ # @return [String] The full URL to the asset or when host cannot be
28
+ # resolved, the asset path.
29
+ def url(**options)
30
+ path = ActionController::Base.helpers.asset_pack_path(asset, **options)
31
+ "#{asset_host}#{path}"
32
+ end
33
+
34
+ private
35
+
36
+ attr_reader :asset, :model
37
+
38
+ # Fetches the organization from the model or returns the model itself if
39
+ # it is an organization.
40
+ #
41
+ # @return [Decidim::Organization]
42
+ def organization
43
+ @organization ||=
44
+ if model.is_a?(Decidim::Organization)
45
+ model
46
+ else
47
+ model.try(:organization)
48
+ end
49
+ end
50
+
51
+ # Resolves the full asset host with the resolved options and also adds the
52
+ # port at the end of the URL unless it is the default port 80 or 443.
53
+ #
54
+ # @return [String] The hostname with protocol and port or an empty string
55
+ # when the host cannot be resolved.
56
+ def asset_host
57
+ return "" if default_options[:host].blank?
58
+
59
+ base_host = ActionController::Base.helpers.compute_asset_host("", **default_options)
60
+ return "" if base_host.blank?
61
+ return base_host if option_resolver.default_port?
62
+
63
+ "#{base_host}:#{option_resolver.port}"
64
+ end
65
+
66
+ # Determines the default options to be passed to the route helper.
67
+ #
68
+ # @return [Hash] The default options hash to pass to the route helper
69
+ def default_options
70
+ @default_options ||= option_resolver.options.tap do |opts|
71
+ opts[:host] = default_host if default_host
72
+ end
73
+ end
74
+
75
+ # Determines the default host for the pipeline assets. Either the
76
+ # configured assets host or the organization host when available. When the
77
+ # default host is not available, the host returned by the
78
+ # UrlOptionResolver will be used.
79
+ #
80
+ # @return [String, nil]
81
+ def default_host
82
+ @default_host ||= Rails.configuration.action_controller.asset_host || organization&.host
83
+ end
84
+
85
+ # Stores an instance of UrlOptionResolver for convenience.
86
+ #
87
+ # @return [Decidim::UrlOptionResolver]
88
+ def option_resolver
89
+ @option_resolver ||= UrlOptionResolver.new
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module AssetRouter
5
+ # Storage asset router provides global access to the asset routes for assets
6
+ # saved through ActiveStorage. This handles the different cases for routing
7
+ # to the remote routes when using an assets CDN or to local routes when
8
+ # using the local disk storage driver.
9
+ class Storage
10
+ # Initializes the router.
11
+ #
12
+ # @param [ActiveStorage::Attached, ActiveStorage::Blob] The asset to route
13
+ # to
14
+ def initialize(asset)
15
+ @asset = asset
16
+ end
17
+
18
+ # Generates the correct URL to the asset with the provided options.
19
+ #
20
+ # @param options The options for the URL that are the normal route options
21
+ # Rails route helpers accept
22
+ def url(**options)
23
+ if asset.is_a? ActiveStorage::Attached
24
+ routes.rails_blob_url(asset.blob, **default_options.merge(options))
25
+ else
26
+ routes.rails_representation_url(asset, **default_options.merge(options))
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ attr_reader :asset
33
+
34
+ # Provides the route helpers depending on whether the URL is generated to
35
+ # the local host or an external CDN (remote).
36
+ #
37
+ # @return [Module, Decidim::EngineRouter] The correct route helpers based
38
+ # on the configuration
39
+ def routes
40
+ @routes ||=
41
+ if remote?
42
+ Rails.application.routes.url_helpers
43
+ else
44
+ EngineRouter.new("main_app", {})
45
+ end
46
+ end
47
+
48
+ # Determines whether the assets call should be to a remote CDN or to the
49
+ # local server based on the storage options.
50
+ #
51
+ # @return [Boolean] A boolean indicating whether the assets are served
52
+ # through a remote CDN
53
+ def remote?
54
+ remote_storage_options.present?
55
+ end
56
+
57
+ # Determines the default options to be passed to the route helper. For the
58
+ # remote storage, returns the remote storage options and for the local
59
+ # disk storage returns an empty hash.
60
+ #
61
+ # @return [Hash] The default options hash to pass to the route helper
62
+ def default_options
63
+ @default_options ||=
64
+ if remote?
65
+ remote_storage_options
66
+ else
67
+ {}
68
+ end
69
+ end
70
+
71
+ # The remote storage options when using a remote CDN. An empty hash in
72
+ # case using the local disk storage.
73
+ #
74
+ # @return [Hash] The remote storage options hash
75
+ def remote_storage_options
76
+ @remote_storage_options ||= {
77
+ host: Rails.application.secrets.dig(:storage, :cdn_host)
78
+ }.compact
79
+ end
80
+ end
81
+ end
82
+ end
@@ -1,80 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
- # Asset router provides global access to the asset routes for assets saved
5
- # through ActiveStorage. This handles the different cases for routing to the
6
- # remote routes when using an assets CDN or to local routes when using the
7
- # local disk storage driver.
8
- class AssetRouter
9
- # Initializes the router.
10
- #
11
- # @param [ActiveStorage::Attached, ActiveStorage::Blob] The asset to route
12
- # to
13
- def initialize(asset)
14
- @asset = asset
15
- end
16
-
17
- # Generates the correct URL to the asset with the provided options.
18
- #
19
- # @param options The options for the URL that are the normal route options
20
- # Rails route helpers accept
21
- def url(**options)
22
- if asset.is_a? ActiveStorage::Attached
23
- routes.rails_blob_url(asset.blob, **default_options.merge(options))
24
- else
25
- routes.rails_representation_url(asset, **default_options.merge(options))
26
- end
27
- end
28
-
29
- private
30
-
31
- attr_reader :asset
32
-
33
- # Provides the route helpers depending on whether the URL is generated to
34
- # the local host or an external CDN (remote).
35
- #
36
- # @return [Module, Decidim::EngineRouter] The correct route helpers based
37
- # on the configuration
38
- def routes
39
- @routes ||=
40
- if remote?
41
- Rails.application.routes.url_helpers
42
- else
43
- EngineRouter.new("main_app", {})
44
- end
45
- end
46
-
47
- # Determines whether the assets call should be to a remote CDN or to the
48
- # local server based on the storage options.
49
- #
50
- # @return [Boolean] A boolean indicating whether the assets are served
51
- # through a remote CDN
52
- def remote?
53
- remote_storage_options.present?
54
- end
55
-
56
- # Determines the default options to be passed to the route helper. For the
57
- # remote storage, returns the remote storage options and for the local disk
58
- # storage returns an empty hash.
59
- #
60
- # @return [Hash] The default options hash to pass to the route helper
61
- def default_options
62
- @default_options ||=
63
- if remote?
64
- remote_storage_options
65
- else
66
- {}
67
- end
68
- end
69
-
70
- # The remote storage options when using a remote CDN. An empty hash in case
71
- # using the local disk storage.
72
- #
73
- # @return [Hash] The remote storage options hash
74
- def remote_storage_options
75
- @remote_storage_options ||= {
76
- host: Rails.application.secrets.dig(:storage, :cdn_host)
77
- }.compact
78
- end
4
+ module AssetRouter
5
+ autoload :Pipeline, "decidim/asset_router/pipeline"
6
+ autoload :Storage, "decidim/asset_router/storage"
79
7
  end
80
8
  end
@@ -48,6 +48,15 @@ module Decidim
48
48
  value.attachment.try(:blob)
49
49
  when ActiveStorage::Attached::Many
50
50
  value.attachments.map(&:blob)
51
+ when ActiveRecord::Associations::CollectionProxy, ActiveRecord::Relation, Array
52
+ if attribute_types[key].type == :array
53
+ value
54
+ else
55
+ # This is a sub-form that needs to read the properties directly
56
+ # from the original model. We cannot pass an array here as it
57
+ # would be passed to the form constructor causing an error.
58
+ model
59
+ end
51
60
  else
52
61
  value
53
62
  end
@@ -234,13 +234,20 @@ FactoryBot.define do
234
234
  confirmed_at { Time.current }
235
235
  end
236
236
 
237
+ trait :blocked do
238
+ blocked { true }
239
+ blocked_at { Time.current }
240
+ extended_data { { user_name: generate(:name) } }
241
+ name { "Blocked user group" }
242
+ end
243
+
237
244
  after(:build) do |user_group, evaluator|
238
- user_group.extended_data = {
239
- document_number: evaluator.document_number,
240
- phone: evaluator.phone,
241
- rejected_at: evaluator.rejected_at,
242
- verified_at: evaluator.verified_at
243
- }
245
+ user_group.extended_data = user_group.extended_data.merge({
246
+ document_number: evaluator.document_number,
247
+ phone: evaluator.phone,
248
+ rejected_at: evaluator.rejected_at,
249
+ verified_at: evaluator.verified_at
250
+ })
244
251
  end
245
252
 
246
253
  after(:create) do |user_group, evaluator|
@@ -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.27.1"
7
+ "0.27.2"
8
8
  end
9
9
  end
10
10
  end
@@ -28,11 +28,9 @@ module Decidim
28
28
  # specs which means any gems available in the gem install folder.
29
29
  #
30
30
  # @param gem [String] The name for the gem to be looked up.
31
- # @return [Bundler::LazySpecification, Gem::Specification, nil] When bundler
32
- # is available, returns `Bundler::LazySpecification`. When bundler is not
33
- # available, returns `Gem::Specification`. Both of these implement the
34
- # necessary methods for the other checks. In both cases returns nil if
35
- # the gem is not found.
31
+ # @return [Gem::Specification, nil] Returns the gem specification for the
32
+ # given gem name. The specification implements the necessary methods for
33
+ # the other checks. In both cases returns nil if the gem is not found.
36
34
  def lookup(gem)
37
35
  # In case the lookup method is called with a spec definition, return the
38
36
  # definition itself.
@@ -217,10 +215,18 @@ module Decidim
217
215
  # Gemfile, e.g. when the Decidim gems are installed through git.
218
216
  #
219
217
  # @param name [String] The name of the gem to find.
220
- # @return [Bundler::LazySpecification, nil] The specification for the gem
221
- # or nil if the gem is not listed in the locked gems.
218
+ # @return [Gem::Specification, nil] The specification for the gem
219
+ # or nil if the gem is not listed in the locked gems or nil when the
220
+ # returned spec is not installed in the current gem environment.
222
221
  def spec(name)
223
- Bundler.definition.locked_gems.specs.find { |s| s.name == name }
222
+ sp = Bundler.definition.locked_gems.specs.find { |s| s.name == name }
223
+
224
+ # Fetching the gem through Gem.loaded_specs ensures we are not returning
225
+ # a lazy specification which does not respond to `#full_gem_path` which
226
+ # is needed for the resolver.
227
+ return Gem.loaded_specs[sp.name] if sp
228
+
229
+ nil
224
230
  end
225
231
 
226
232
  private
@@ -47,7 +47,7 @@ module Decidim
47
47
  # rubocop:enable Metrics/ParameterLists
48
48
 
49
49
  def create_language_selector(locales, tabs_id, name)
50
- if Decidim.available_locales.count > 4
50
+ if locales.count > 4
51
51
  language_selector_select(locales, tabs_id, name)
52
52
  else
53
53
  language_tabs(locales, tabs_id, name)
@@ -47,7 +47,13 @@ module Decidim
47
47
  .joins(:participatory_space_resource_links_to)
48
48
  .where(decidim_participatory_space_links: { name: link_name, from_id: id, from_type: self.class.name })
49
49
 
50
- klass.where(id: from).or(klass.where(id: to))
50
+ query = klass.where(id: from).or(klass.where(id: to)).published
51
+
52
+ if klass.column_names.include?("weight")
53
+ query.order(:weight)
54
+ else
55
+ query.order(created_at: :desc)
56
+ end
51
57
  end
52
58
 
53
59
  def participatory_space_sibling_scope(participatory_space_name)
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.27.1
4
+ version: 0.27.2
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: 2022-11-15 00:00:00.000000000 Z
13
+ date: 2023-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -740,28 +740,28 @@ dependencies:
740
740
  requirements:
741
741
  - - '='
742
742
  - !ruby/object:Gem::Version
743
- version: 0.27.1
743
+ version: 0.27.2
744
744
  type: :runtime
745
745
  prerelease: false
746
746
  version_requirements: !ruby/object:Gem::Requirement
747
747
  requirements:
748
748
  - - '='
749
749
  - !ruby/object:Gem::Version
750
- version: 0.27.1
750
+ version: 0.27.2
751
751
  - !ruby/object:Gem::Dependency
752
752
  name: decidim-dev
753
753
  requirement: !ruby/object:Gem::Requirement
754
754
  requirements:
755
755
  - - '='
756
756
  - !ruby/object:Gem::Version
757
- version: 0.27.1
757
+ version: 0.27.2
758
758
  type: :development
759
759
  prerelease: false
760
760
  version_requirements: !ruby/object:Gem::Requirement
761
761
  requirements:
762
762
  - - '='
763
763
  - !ruby/object:Gem::Version
764
- version: 0.27.1
764
+ version: 0.27.2
765
765
  description: Adds core features so other engines can hook into the framework.
766
766
  email:
767
767
  - josepjaume@gmail.com
@@ -2042,6 +2042,7 @@ files:
2042
2042
  - config/locales/is.yml
2043
2043
  - config/locales/it.yml
2044
2044
  - config/locales/ja.yml
2045
+ - config/locales/ka-GE.yml
2045
2046
  - config/locales/ko-KR.yml
2046
2047
  - config/locales/ko.yml
2047
2048
  - config/locales/lb-LU.yml
@@ -2361,6 +2362,8 @@ files:
2361
2362
  - lib/decidim/api/types/user_group_type.rb
2362
2363
  - lib/decidim/api/types/user_type.rb
2363
2364
  - lib/decidim/asset_router.rb
2365
+ - lib/decidim/asset_router/pipeline.rb
2366
+ - lib/decidim/asset_router/storage.rb
2364
2367
  - lib/decidim/attachment_attributes.rb
2365
2368
  - lib/decidim/attribute_encryptor.rb
2366
2369
  - lib/decidim/attribute_object.rb
@@ -2696,7 +2699,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2696
2699
  - !ruby/object:Gem::Version
2697
2700
  version: '0'
2698
2701
  requirements: []
2699
- rubygems_version: 3.2.22
2702
+ rubygems_version: 3.3.7
2700
2703
  signing_key:
2701
2704
  specification_version: 4
2702
2705
  summary: The core of the Decidim framework.