decidim-core 0.27.5 → 0.27.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +2 -2
- data/app/cells/decidim/card_cell.rb +2 -2
- data/app/cells/decidim/card_m/top.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/scopes_picker/scope_picker_values.erb +1 -1
- data/app/cells/decidim/tags_cell.rb +3 -1
- data/app/cells/decidim/user_profile_cell.rb +1 -1
- data/app/commands/decidim/create_omniauth_registration.rb +2 -4
- data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
- data/app/commands/decidim/messaging/start_conversation.rb +3 -0
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
- data/app/controllers/concerns/decidim/paginable.rb +1 -1
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
- data/app/controllers/decidim/widgets_controller.rb +6 -0
- data/app/events/decidim/welcome_notification_event.rb +6 -9
- data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +4 -4
- data/app/helpers/decidim/newsletters_helper.rb +83 -16
- data/app/helpers/decidim/resource_helper.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +9 -0
- data/app/helpers/decidim/user_profile_helper.rb +7 -2
- data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
- data/app/models/decidim/push_notification_message.rb +39 -0
- data/app/packs/images/decidim/.keep +0 -0
- data/app/packs/src/decidim/input_hashtags.js +1 -1
- data/app/packs/src/decidim/input_mentions.js +1 -1
- data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
- data/app/packs/src/decidim/vizzs/index.js +1 -1
- data/app/packs/stylesheets/decidim/plugins/leaflet.scss +118 -114
- data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
- data/app/services/decidim/events_manager.rb +6 -0
- data/app/services/decidim/push_notification_message_sender.rb +36 -0
- data/app/services/decidim/send_push_notification.rb +22 -8
- data/app/views/decidim/devise/registrations/new.html.erb +2 -2
- data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
- data/app/views/decidim/shared/_address_details.html.erb +2 -2
- data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
- data/config/locales/ar.yml +4 -2
- data/config/locales/bg.yml +74 -0
- data/config/locales/ca.yml +22 -22
- data/config/locales/de.yml +25 -25
- data/config/locales/el.yml +1 -3
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/es.yml +20 -20
- data/config/locales/eu.yml +11 -2
- data/config/locales/fi.yml +3 -3
- data/config/locales/fr-CA.yml +2 -2
- data/config/locales/fr.yml +2 -2
- data/config/locales/gl.yml +3 -0
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +41 -8
- data/config/locales/it.yml +1 -3
- data/config/locales/ja.yml +3 -2
- data/config/locales/lb.yml +1 -3
- data/config/locales/lt.yml +0 -3
- data/config/locales/no.yml +1 -3
- data/config/locales/pl.yml +137 -1
- data/config/locales/pt-BR.yml +113 -21
- data/config/locales/pt.yml +1 -3
- data/config/locales/ro-RO.yml +0 -3
- data/config/locales/ru.yml +9 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/sv.yml +22 -2
- data/config/locales/tr-TR.yml +1 -3
- data/config/locales/uk.yml +14 -0
- data/config/locales/zh-CN.yml +0 -3
- data/config/locales/zh-TW.yml +0 -3
- data/decidim-core.gemspec +78 -0
- data/lib/decidim/acts_as_tree.rb +14 -1
- data/lib/decidim/asset_router/storage.rb +4 -0
- data/lib/decidim/attribute_encryptor.rb +6 -4
- data/lib/decidim/core/engine.rb +7 -3
- data/lib/decidim/core/test/factories.rb +308 -95
- data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +32 -0
- data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +187 -11
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +4 -4
- data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
- data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
- data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -2
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +6 -3
- data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +50 -2
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +1 -0
- data/lib/decidim/engine_router.rb +17 -4
- data/lib/decidim/events/base_event.rb +5 -2
- data/lib/decidim/events/simple_event.rb +3 -17
- data/lib/decidim/has_category.rb +1 -1
- data/lib/decidim/has_conversations.rb +91 -0
- data/lib/decidim/participable.rb +17 -0
- data/lib/decidim/view_model.rb +1 -0
- data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
- data/lib/premailer/adapter/decidim.rb +5 -4
- data/lib/tasks/decidim_reminders_tasks.rake +1 -0
- data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
- metadata +31 -30
- data/config/environment.rb +0 -3
data/lib/decidim/acts_as_tree.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Decidim
|
4
|
+
# Adapted from https://hashrocket.com/blog/posts/recursive-sql-in-activerecord
|
4
5
|
module ActsAsTree
|
5
6
|
extend ActiveSupport::Concern
|
6
7
|
|
@@ -15,10 +16,22 @@ module Decidim
|
|
15
16
|
@parent_item_foreign_key = name
|
16
17
|
end
|
17
18
|
|
19
|
+
def parent_item_polymorphic_type_key(name = nil)
|
20
|
+
return @parent_item_polymorphic_type_key unless name
|
21
|
+
|
22
|
+
@parent_item_polymorphic_type_key = name
|
23
|
+
end
|
24
|
+
|
18
25
|
def tree_for(item)
|
19
26
|
where(Arel.sql("#{table_name}.id IN (#{tree_sql_for(item)})")).order("#{table_name}.id")
|
20
27
|
end
|
21
28
|
|
29
|
+
def polymorphic_condition(item)
|
30
|
+
return "" if parent_item_polymorphic_type_key.blank?
|
31
|
+
|
32
|
+
"AND #{table_name}.#{parent_item_polymorphic_type_key} = '#{item.class.name}'"
|
33
|
+
end
|
34
|
+
|
22
35
|
def tree_sql_for(item)
|
23
36
|
<<-SQL.squish
|
24
37
|
WITH RECURSIVE search_tree(id, path) AS (
|
@@ -28,7 +41,7 @@ module Decidim
|
|
28
41
|
UNION ALL
|
29
42
|
SELECT #{table_name}.id, path || #{table_name}.id
|
30
43
|
FROM search_tree
|
31
|
-
JOIN #{table_name} ON #{table_name}.#{parent_item_foreign_key} = search_tree.id
|
44
|
+
JOIN #{table_name} ON #{table_name}.#{parent_item_foreign_key} = search_tree.id #{polymorphic_condition(item)}
|
32
45
|
WHERE NOT #{table_name}.id = ANY(path)
|
33
46
|
)
|
34
47
|
SELECT id FROM search_tree ORDER BY path
|
@@ -19,13 +19,17 @@ module Decidim
|
|
19
19
|
#
|
20
20
|
# @param options The options for the URL that are the normal route options
|
21
21
|
# Rails route helpers accept
|
22
|
+
# rubocop:disable Style/CaseLikeIf
|
22
23
|
def url(**options)
|
23
24
|
if asset.is_a? ActiveStorage::Attached
|
24
25
|
routes.rails_blob_url(asset.blob, **default_options.merge(options))
|
26
|
+
elsif asset.is_a? ActiveStorage::Blob
|
27
|
+
routes.rails_blob_url(asset, **default_options.merge(options))
|
25
28
|
else
|
26
29
|
routes.rails_representation_url(asset, **default_options.merge(options))
|
27
30
|
end
|
28
31
|
end
|
32
|
+
# rubocop:enable Style/CaseLikeIf
|
29
33
|
|
30
34
|
private
|
31
35
|
|
@@ -19,10 +19,12 @@ module Decidim
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.cryptor
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
@cryptor ||= begin
|
23
|
+
key = ActiveSupport::KeyGenerator.new("attribute").generate_key(
|
24
|
+
Rails.application.secrets.secret_key_base, ActiveSupport::MessageEncryptor.key_len
|
25
|
+
)
|
26
|
+
ActiveSupport::MessageEncryptor.new(key)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
data/lib/decidim/core/engine.rb
CHANGED
@@ -246,9 +246,13 @@ module Decidim
|
|
246
246
|
end
|
247
247
|
|
248
248
|
initializer "decidim.notifications" do
|
249
|
-
|
250
|
-
|
251
|
-
|
249
|
+
if Rails.autoloaders.zeitwerk_enabled?
|
250
|
+
config.after_initialize do
|
251
|
+
Decidim::EventsManager.subscribe_events!
|
252
|
+
end
|
253
|
+
else
|
254
|
+
config.to_prepare do
|
255
|
+
Decidim::EventsManager.subscribe_events!
|
252
256
|
end
|
253
257
|
end
|
254
258
|
end
|