decidim-core 0.25.0 → 0.26.0.rc2
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.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +2 -1
- data/app/cells/decidim/author/flag_user.erb +1 -1
- data/app/cells/decidim/author/profile_inline.erb +1 -1
- data/app/cells/decidim/author/withdraw.erb +2 -2
- data/app/cells/decidim/author_cell.rb +32 -0
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/cta_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/hero_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +1 -1
- data/app/cells/decidim/content_blocks/how_to_participate/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/stats_cell.rb +12 -0
- data/app/cells/decidim/endorsers_list_cell.rb +3 -1
- data/app/cells/decidim/flag_modal/flag_user.erb +2 -2
- data/app/cells/decidim/flag_modal/show.erb +2 -2
- data/app/cells/decidim/flag_modal_cell.rb +10 -0
- data/app/cells/decidim/following/show.erb +17 -8
- data/app/cells/decidim/following_cell.rb +6 -2
- data/app/cells/decidim/notification/show.erb +31 -0
- data/app/cells/decidim/notification_cell.rb +20 -0
- data/app/cells/decidim/notifications/show.erb +1 -24
- data/app/cells/decidim/notifications_cell.rb +0 -1
- data/app/cells/decidim/user_conversation/conversation_header.erb +1 -1
- data/app/cells/decidim/user_conversation/show.erb +4 -2
- data/app/cells/decidim/user_conversations/conversation_item.erb +1 -1
- data/app/commands/decidim/create_editor_image.rb +41 -0
- data/app/controllers/concerns/decidim/disable_redirection_to_external_host.rb +15 -0
- data/app/controllers/concerns/decidim/safe_redirect.rb +14 -3
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/cookie_policy_controller.rb +2 -0
- data/app/controllers/decidim/editor_images_controller.rb +47 -0
- data/app/controllers/decidim/user_activities_controller.rb +2 -1
- data/app/forms/decidim/editor_image_form.rb +16 -0
- data/app/helpers/decidim/amendments_helper.rb +1 -1
- data/app/helpers/decidim/application_helper.rb +2 -2
- data/app/helpers/decidim/messaging/conversation_helper.rb +32 -3
- data/app/helpers/decidim/resource_versions_helper.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +65 -0
- data/app/models/decidim/editor_image.rb +14 -0
- data/app/models/decidim/messaging/conversation.rb +9 -0
- data/app/models/decidim/participatory_space_private_user.rb +16 -0
- data/app/models/decidim/user.rb +3 -9
- data/app/models/decidim/user_base_entity.rb +24 -13
- data/app/models/decidim/user_group.rb +40 -0
- data/app/packs/entrypoints/decidim_core.js +1 -0
- data/app/packs/src/decidim/dialog_mode.js +143 -0
- data/app/packs/src/decidim/dialog_mode.test.js +168 -0
- data/app/packs/src/decidim/editor.js +56 -14
- data/app/packs/src/decidim/form_attachments.js +5 -0
- data/app/packs/src/decidim/geocoding/attach_input.js +11 -2
- data/app/packs/src/decidim/index.js +4 -0
- data/app/packs/src/decidim/input_emoji.js +10 -1
- data/app/packs/src/decidim/vendor/image-resize.min.js +3 -0
- data/app/packs/src/decidim/vendor/image-upload.min.js +8 -0
- data/app/packs/stylesheets/decidim/extras/_extras.scss +0 -1
- data/app/packs/stylesheets/decidim/extras/_quill.scss +7 -0
- data/app/packs/stylesheets/decidim/modules/_buttons.scss +11 -4
- data/app/packs/stylesheets/decidim/modules/_cards.scss +4 -0
- data/app/packs/stylesheets/decidim/modules/_layout.scss +1 -1
- data/app/packs/stylesheets/decidim/modules/_timeline.scss +1 -1
- data/app/presenters/decidim/nil_presenter.rb +2 -2
- data/app/presenters/decidim/notification_presenter.rb +25 -0
- data/app/presenters/decidim/official_author_presenter.rb +1 -1
- data/app/presenters/decidim/validation_errors_presenter.rb +27 -0
- data/app/queries/decidim/similar_emendations.rb +1 -1
- data/app/resolvers/decidim/core/metric_resolver.rb +1 -1
- data/app/services/decidim/activity_search.rb +2 -2
- data/app/services/decidim/email_notification_generator.rb +4 -1
- data/app/services/decidim/html_truncation.rb +130 -0
- data/app/services/decidim/open_data_exporter.rb +29 -5
- data/app/services/decidim/resource_search.rb +1 -1
- data/app/uploaders/decidim/editor_image_uploader.rb +6 -0
- data/app/validators/password_validator.rb +123 -0
- data/app/views/decidim/account/_password_fields.html.erb +1 -1
- data/app/views/decidim/devise/passwords/edit.html.erb +1 -1
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +6 -4
- data/app/views/decidim/messaging/conversations/_conversation.html.erb +9 -3
- data/app/views/decidim/messaging/conversations/_messages.html.erb +8 -2
- data/app/views/decidim/messaging/conversations/_show.html.erb +10 -12
- data/app/views/decidim/messaging/conversations/show.html.erb +4 -2
- data/app/views/decidim/newsletters/show.html.erb +1 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +17 -0
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/searches/_filters_small_view.html.erb +3 -3
- data/app/views/decidim/shared/_login_modal.html.erb +5 -5
- data/app/views/decidim/shared/_orders.html.erb +1 -1
- data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
- data/app/views/decidim/shared/participatory_space_filters/_filters_small_view.html.erb +3 -3
- data/app/views/layouts/decidim/_application.html.erb +1 -12
- data/app/views/layouts/decidim/_head.html.erb +4 -0
- data/app/views/layouts/decidim/_language_chooser.html.erb +1 -1
- data/app/views/layouts/decidim/_meta_tags_config.html.erb +11 -0
- data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
- data/config/brakeman.ignore +149 -0
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/rack_attack.rb +23 -21
- data/config/locales/ar.yml +8 -0
- data/config/locales/ca.yml +43 -0
- data/config/locales/cs.yml +61 -0
- data/config/locales/en.yml +47 -0
- data/config/locales/es-MX.yml +42 -0
- data/config/locales/es-PY.yml +42 -0
- data/config/locales/es.yml +42 -0
- data/config/locales/eu.yml +27 -12
- data/config/locales/fi-plain.yml +42 -0
- data/config/locales/fi.yml +42 -0
- data/config/locales/fr-CA.yml +43 -0
- data/config/locales/fr.yml +75 -28
- data/config/locales/gl.yml +6 -0
- data/config/locales/it.yml +11 -0
- data/config/locales/ja.yml +85 -49
- data/config/locales/lb-LU.yml +1354 -0
- data/config/locales/lb.yml +1 -1
- data/config/locales/nl.yml +51 -0
- data/config/locales/pl.yml +5 -5
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/ro-RO.yml +275 -252
- data/config/locales/sv.yml +45 -2
- data/config/locales/val-ES.yml +1 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20210730112319_create_decidim_editor_images.rb +12 -0
- data/db/migrate/20211126183540_add_timestamps_to_content_blocks.rb +14 -0
- data/db/seeds.rb +16 -14
- data/lib/decidim/api/functions/user_entity_finder.rb +2 -1
- data/lib/decidim/api/functions/user_entity_list.rb +3 -1
- data/lib/decidim/api/input_sorts/component_input_sort.rb +1 -1
- data/lib/decidim/common_passwords.rb +56 -0
- data/lib/decidim/content_parsers/inline_images_parser.rb +68 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_renderers/link_renderer.rb +85 -1
- data/lib/decidim/content_renderers/user_group_renderer.rb +1 -1
- data/lib/decidim/content_renderers/user_renderer.rb +1 -1
- data/lib/decidim/core/engine.rb +7 -12
- data/lib/decidim/core/test/factories.rb +7 -1
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +131 -0
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +33 -5
- data/lib/decidim/db/common-passwords.txt +128420 -0
- data/lib/decidim/etherpad/pad.rb +48 -0
- data/lib/decidim/etherpad.rb +7 -0
- data/lib/decidim/events/base_event.rb +18 -0
- data/lib/decidim/events/machine_translated_event.rb +36 -0
- data/lib/decidim/events/user_group_event.rb +1 -3
- data/lib/decidim/events.rb +1 -0
- data/lib/decidim/exporters/csv.rb +7 -7
- data/lib/decidim/faker/localized.rb +15 -6
- data/lib/decidim/form_builder.rb +14 -4
- data/lib/decidim/has_attachments.rb +11 -4
- data/lib/decidim/has_component.rb +4 -0
- data/lib/decidim/importers/import_manifest.rb +103 -3
- data/lib/decidim/organization_settings.rb +1 -1
- data/lib/decidim/paddable.rb +1 -9
- data/lib/decidim/participable.rb +5 -0
- data/lib/decidim/resourceable.rb +2 -9
- data/lib/decidim/searchable.rb +2 -2
- data/lib/decidim/settings_manifest.rb +2 -0
- data/lib/decidim/translatable_attributes.rb +6 -6
- data/lib/decidim/view_model.rb +10 -0
- data/lib/tasks/decidim_active_storage_migration_tasks.rake +68 -0
- data/lib/tasks/decidim_webpacker_tasks.rake +4 -10
- metadata +70 -78
- data/app/packs/stylesheets/decidim/extras/_social_icons_mini.scss +0 -11
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
shared_examples_for "a translated event" do
|
|
4
|
+
context "when it is not machine machine translated" do
|
|
5
|
+
let(:organization) { create(:organization, enable_machine_translations: false, machine_translation_display_priority: "original") }
|
|
6
|
+
|
|
7
|
+
it "does not perform translation" do
|
|
8
|
+
expect(subject.perform_translation?).to eq(false)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "does not have a missing translation" do
|
|
12
|
+
expect(subject.translation_missing?).to eq(false)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "does have content available in multiple languages" do
|
|
16
|
+
expect(subject.content_in_same_language?).to eq(false)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "does return the original language" do
|
|
20
|
+
expect(subject.safe_resource_text).to eq(en_version)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "does not offer an alternate translation" do
|
|
24
|
+
expect(subject.safe_resource_translated_text).to eq(en_version)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "when is machine machine translated" do
|
|
29
|
+
let(:user) { create :user, organization: organization, locale: "ca" }
|
|
30
|
+
|
|
31
|
+
around do |example|
|
|
32
|
+
I18n.with_locale(user.locale) { example.run }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "when priority is original" do
|
|
36
|
+
let(:organization) { create(:organization, enable_machine_translations: true, machine_translation_display_priority: "original") }
|
|
37
|
+
|
|
38
|
+
it "does perform translation" do
|
|
39
|
+
expect(subject.perform_translation?).to eq(translatable)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "does not have a missing translation" do
|
|
43
|
+
expect(subject.translation_missing?).to eq(false)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "does have content available in multiple languages" do
|
|
47
|
+
expect(subject.content_in_same_language?).to eq(false)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "does return the original language" do
|
|
51
|
+
expect(subject.safe_resource_text).to eq(en_version)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "does not offer an alternate translation" do
|
|
55
|
+
expect(subject.safe_resource_translated_text).to eq(machine_translated)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
context "when translation is not available" do
|
|
59
|
+
let(:body) { { "en": en_body } }
|
|
60
|
+
|
|
61
|
+
it "does perform translation" do
|
|
62
|
+
expect(subject.perform_translation?).to eq(translatable)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "does have a missing translation" do
|
|
66
|
+
expect(subject.translation_missing?).to eq(translatable)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "does have content available in multiple languages" do
|
|
70
|
+
expect(subject.content_in_same_language?).to eq(false)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "does return the original language" do
|
|
74
|
+
expect(subject.safe_resource_text).to eq(en_version)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it "does not offer an alternate translation" do
|
|
78
|
+
expect(subject.safe_resource_translated_text).to eq(en_version)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
context "when priority is translation" do
|
|
84
|
+
let(:organization) { create(:organization, enable_machine_translations: true, machine_translation_display_priority: "translation") }
|
|
85
|
+
|
|
86
|
+
it "does perform translation" do
|
|
87
|
+
expect(subject.perform_translation?).to eq(translatable)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "does not have a missing translation" do
|
|
91
|
+
expect(subject.translation_missing?).to eq(false)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it "does have content available in multiple languages" do
|
|
95
|
+
expect(subject.content_in_same_language?).to eq(false)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "does return the original language" do
|
|
99
|
+
expect(subject.safe_resource_text).to eq(en_version)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "does not offer an alternate translation" do
|
|
103
|
+
expect(subject.safe_resource_translated_text).to eq(machine_translated)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context "when translation is not available" do
|
|
107
|
+
let(:body) { { "en": en_body } }
|
|
108
|
+
|
|
109
|
+
it "does perform translation" do
|
|
110
|
+
expect(subject.perform_translation?).to eq(translatable)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it "does have a missing translation" do
|
|
114
|
+
expect(subject.translation_missing?).to eq(translatable)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
it "does have content available in multiple languages" do
|
|
118
|
+
expect(subject.content_in_same_language?).to eq(false)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it "does return the original language" do
|
|
122
|
+
expect(subject.safe_resource_text).to eq(en_version)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it "does not offer an alternate translation" do
|
|
126
|
+
expect(subject.safe_resource_translated_text).to eq(en_version)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
data/lib/decidim/core/test.rb
CHANGED
|
@@ -68,3 +68,4 @@ require "decidim/core/test/shared_examples/controller_render_views"
|
|
|
68
68
|
require "decidim/core/test/shared_examples/share_link_examples"
|
|
69
69
|
require "decidim/core/test/shared_examples/categories_container_examples"
|
|
70
70
|
require "decidim/core/test/shared_examples/assembly_announcements_examples"
|
|
71
|
+
require "decidim/core/test/shared_examples/translated_event_examples"
|
data/lib/decidim/core/version.rb
CHANGED
data/lib/decidim/core.rb
CHANGED
|
@@ -77,6 +77,7 @@ module Decidim
|
|
|
77
77
|
autoload :Amendable, "decidim/amendable"
|
|
78
78
|
autoload :Gamification, "decidim/gamification"
|
|
79
79
|
autoload :Hashtag, "decidim/hashtag"
|
|
80
|
+
autoload :Etherpad, "decidim/etherpad"
|
|
80
81
|
autoload :Paddable, "decidim/paddable"
|
|
81
82
|
autoload :OpenDataExporter, "decidim/open_data_exporter"
|
|
82
83
|
autoload :IoEncoder, "decidim/io_encoder"
|
|
@@ -95,6 +96,7 @@ module Decidim
|
|
|
95
96
|
autoload :RecordEncryptor, "decidim/record_encryptor"
|
|
96
97
|
autoload :AttachmentAttributes, "decidim/attachment_attributes"
|
|
97
98
|
autoload :CarrierWaveMigratorService, "decidim/carrier_wave_migrator_service"
|
|
99
|
+
autoload :CommonPasswords, "decidim/common_passwords"
|
|
98
100
|
|
|
99
101
|
include ActiveSupport::Configurable
|
|
100
102
|
# Loads seeds from all engines.
|
|
@@ -145,9 +147,9 @@ module Decidim
|
|
|
145
147
|
# the mails.
|
|
146
148
|
config_accessor :mailer_sender
|
|
147
149
|
|
|
148
|
-
# Whether SSL should be
|
|
150
|
+
# Whether SSL should be forced or not.
|
|
149
151
|
config_accessor :force_ssl do
|
|
150
|
-
|
|
152
|
+
Rails.env.starts_with?("production") || Rails.env.starts_with?("staging")
|
|
151
153
|
end
|
|
152
154
|
|
|
153
155
|
# Having this on true will change the way the svg assets are being served.
|
|
@@ -165,6 +167,13 @@ module Decidim
|
|
|
165
167
|
:en
|
|
166
168
|
end
|
|
167
169
|
|
|
170
|
+
# Disable the redirection to the external host when performing redirect back
|
|
171
|
+
# For more details https://github.com/rails/rails/issues/39643
|
|
172
|
+
# Additional context: This has been revealed as an issue during a security audit on Future of Europe installation
|
|
173
|
+
config_accessor :allow_open_redirects do
|
|
174
|
+
false
|
|
175
|
+
end
|
|
176
|
+
|
|
168
177
|
# Exposes a configuration option: an array of symbols representing processors
|
|
169
178
|
# that will be automatically executed when a content is parsed or rendered.
|
|
170
179
|
#
|
|
@@ -267,7 +276,7 @@ module Decidim
|
|
|
267
276
|
|
|
268
277
|
# Time window were users can access the website even if their email is not confirmed.
|
|
269
278
|
config_accessor :unconfirmed_access_for do
|
|
270
|
-
|
|
279
|
+
0.days
|
|
271
280
|
end
|
|
272
281
|
|
|
273
282
|
# Allow machine translations
|
|
@@ -377,6 +386,18 @@ module Decidim
|
|
|
377
386
|
"decidim-cc"
|
|
378
387
|
end
|
|
379
388
|
|
|
389
|
+
# Blacklisted passwords. Array may contain strings and regex entries.
|
|
390
|
+
config_accessor :password_blacklist do
|
|
391
|
+
[]
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# This is an internal key that allow us to properly configure the caching key separator. This is useful for redis cache store
|
|
395
|
+
# as it creates some namespaces within the cached data.
|
|
396
|
+
# use `config.cache_key_separator = ":"` in your initializer to have namespaced data
|
|
397
|
+
config_accessor :cache_key_separator do
|
|
398
|
+
"/"
|
|
399
|
+
end
|
|
400
|
+
|
|
380
401
|
# Public: Registers a global engine. This method is intended to be used
|
|
381
402
|
# by component engines that also offer unscoped functionality
|
|
382
403
|
#
|
|
@@ -586,8 +607,11 @@ module Decidim
|
|
|
586
607
|
end
|
|
587
608
|
|
|
588
609
|
# Defines the time after which the machine translation job should be enabled.
|
|
589
|
-
# In some cases,
|
|
590
|
-
#
|
|
610
|
+
# In some cases, like when Workers is processing faster than ActiveRecord can commit to Database,
|
|
611
|
+
# it is required to have a delay, to prevent any discarding with
|
|
612
|
+
# Decidim::MachineTranslationResourceJob due to a ActiveJob::DeserializationError.
|
|
613
|
+
# In some Decidim Installations, ActiveJob can be configured to discard jobs failing with
|
|
614
|
+
# ActiveJob::DeserializationError
|
|
591
615
|
config_accessor :machine_translation_delay do
|
|
592
616
|
0.seconds
|
|
593
617
|
end
|
|
@@ -597,4 +621,8 @@ module Decidim
|
|
|
597
621
|
|
|
598
622
|
Decidim.machine_translation_service.to_s.safe_constantize
|
|
599
623
|
end
|
|
624
|
+
|
|
625
|
+
def self.register_assets_path(path)
|
|
626
|
+
Rails.autoloaders.main.ignore(path) if Rails.configuration.autoloader == :zeitwerk
|
|
627
|
+
end
|
|
600
628
|
end
|