decidim-core 0.28.0 → 0.28.2
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/address/online.erb +27 -9
- data/app/cells/decidim/address/show.erb +27 -12
- data/app/cells/decidim/address_cell.rb +29 -0
- data/app/cells/decidim/announcement/show.erb +2 -2
- data/app/cells/decidim/author/show.erb +5 -5
- data/app/cells/decidim/authorization_modal/show.erb +8 -4
- data/app/cells/decidim/authorization_modal_cell.rb +1 -0
- data/app/cells/decidim/card/show.erb +1 -1
- data/app/cells/decidim/card_metadata/show.erb +2 -2
- data/app/cells/decidim/card_metadata_cell.rb +3 -3
- data/app/cells/decidim/coauthorships_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +6 -0
- data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +20 -4
- data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +8 -0
- data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb +13 -0
- data/app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb +1 -1
- data/app/cells/decidim/data_consent/category.erb +1 -1
- data/app/cells/decidim/footer_pages_cell.rb +3 -3
- data/app/cells/decidim/nav_links/show.erb +2 -2
- data/app/cells/decidim/notification/moderated.erb +12 -0
- data/app/cells/decidim/notification_cell.rb +5 -1
- data/app/cells/decidim/profile/details.erb +1 -1
- data/app/cells/decidim/profile/tabs.erb +3 -2
- data/app/cells/decidim/progress_bar/show.erb +1 -1
- data/app/cells/decidim/progress_bar_cell.rb +2 -0
- data/app/cells/decidim/report_button/flag_modal.erb +5 -1
- data/app/cells/decidim/resource_types_filter/show.erb +3 -3
- data/app/cells/decidim/statistic/show.erb +2 -2
- data/app/cells/decidim/tags_cell.rb +3 -1
- data/app/cells/decidim/upload_modal/modal.erb +1 -2
- data/app/commands/decidim/create_omniauth_registration.rb +1 -3
- 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/force_authentication.rb +1 -1
- data/app/controllers/concerns/decidim/paginable.rb +1 -1
- data/app/controllers/concerns/decidim/use_organization_time_zone.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/gamification/badges_controller.rb +2 -0
- data/app/controllers/decidim/links_controller.rb +15 -2
- data/app/events/decidim/welcome_notification_event.rb +6 -9
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +2 -2
- data/app/helpers/decidim/application_helper.rb +0 -18
- data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +7 -8
- data/app/helpers/decidim/layout_helper.rb +1 -1
- data/app/helpers/decidim/map_helper.rb +1 -1
- data/app/helpers/decidim/menu_helper.rb +2 -0
- data/app/helpers/decidim/newsletters_helper.rb +83 -16
- data/app/helpers/decidim/paginate_helper.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +9 -0
- data/app/helpers/decidim/social_share_button_helper.rb +1 -1
- data/app/helpers/decidim/user_profile_helper.rb +7 -2
- data/app/mailers/decidim/application_mailer.rb +40 -6
- data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
- data/app/models/decidim/push_notification_message.rb +38 -0
- data/app/packs/entrypoints/decidim_overrides.scss +2 -0
- data/app/packs/images/decidim/.keep +0 -0
- data/app/packs/src/decidim/a11y.js +15 -1
- data/app/packs/src/decidim/abide_form_validator_fixer.js +44 -0
- data/app/packs/src/decidim/account_form.js +1 -1
- data/app/packs/src/decidim/data_consent/consent_manager.test.js +1 -1
- data/app/packs/src/decidim/data_consent/index.js +1 -1
- data/app/packs/src/decidim/direct_uploads/upload_field.js +1 -1
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +5 -5
- data/app/packs/src/decidim/editor/extensions/hashtag/index.js +1 -1
- data/app/packs/src/decidim/editor/extensions/mention/index.js +1 -1
- data/app/packs/src/decidim/editor/extensions/video_embed/index.js +3 -0
- data/app/packs/src/decidim/editor/test/editor/create.test.js +1 -1
- data/app/packs/src/decidim/editor/test/extensions/bold.test.js +2 -3
- data/app/packs/src/decidim/editor/test/extensions/character_count.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +2 -3
- data/app/packs/src/decidim/editor/test/extensions/dialog.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/emoji.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/hashtag.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/heading.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/image.test.js +4 -4
- data/app/packs/src/decidim/editor/test/extensions/indent.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/link.test.js +3 -3
- data/app/packs/src/decidim/editor/test/extensions/mention.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/ordered_list.test.js +2 -2
- data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +3 -3
- data/app/packs/src/decidim/editor/test/helpers.js +5 -4
- data/app/packs/src/decidim/editor/test/toolbar/basic.test.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/content.test.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/full.test.js +3 -3
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic.js +6 -6
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +1 -1
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content.js +7 -7
- data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +2 -2
- data/app/packs/src/decidim/editor/test/toolbar/shared/context.js +1 -1
- data/app/packs/src/decidim/editor/test/utilities/paste_transform.test.js +2 -2
- data/app/packs/src/decidim/external_domain_warning.js +13 -0
- data/app/packs/src/decidim/external_domain_warning.test.js +1 -1
- data/app/packs/src/decidim/external_link.js +48 -9
- data/app/packs/src/decidim/external_link.test.js +1 -1
- data/app/packs/src/decidim/focus_guard.js +8 -20
- data/app/packs/src/decidim/form_filter.component_for_testing.js +1 -1
- data/app/packs/src/decidim/form_filter.js +3 -3
- data/app/packs/src/decidim/geocoding/attach_input.js +1 -1
- data/app/packs/src/decidim/i18n.test.js +1 -1
- data/app/packs/src/decidim/index.js +33 -2
- 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/sw/index.js +3 -3
- data/app/packs/src/decidim/user_registrations.js +1 -1
- data/app/packs/src/decidim/vizzs/index.js +1 -1
- data/app/packs/stylesheets/decidim/_accordion.scss +2 -2
- data/app/packs/stylesheets/decidim/_cards.scss +4 -4
- data/app/packs/stylesheets/decidim/_dropdown.scss +2 -2
- data/app/packs/stylesheets/decidim/_layout.scss +7 -7
- data/app/packs/stylesheets/decidim/_modal_update.scss +1 -3
- data/app/packs/stylesheets/decidim/application.scss +0 -3
- data/app/packs/stylesheets/decidim/decidim_application.scss +4 -0
- data/app/packs/stylesheets/decidim/legacy/leaflet.scss +88 -107
- data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
- data/app/presenters/decidim/log/diff_presenter.rb +1 -1
- data/app/presenters/decidim/log/resource_presenter.rb +7 -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/iframe_disabler.rb +4 -0
- data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
- data/app/services/decidim/push_notification_message_sender.rb +40 -0
- data/app/services/decidim/send_push_notification.rb +22 -8
- data/app/uploaders/decidim/background_image_uploader.rb +11 -0
- data/app/views/decidim/account/show.html.erb +2 -2
- data/app/views/decidim/application/_collection.html.erb +2 -2
- data/app/views/decidim/application/_document.html.erb +3 -3
- data/app/views/decidim/devise/registrations/new.html.erb +2 -2
- data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +2 -1
- data/app/views/decidim/gamification/badges/index.html.erb +34 -33
- data/app/views/decidim/links/_modal.html.erb +1 -1
- data/app/views/decidim/links/new.html.erb +3 -1
- data/app/views/decidim/manifests/show.json.erb +1 -1
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
- data/app/views/decidim/notifications_settings/show.html.erb +6 -6
- data/app/views/decidim/offline/show.html.erb +15 -9
- data/app/views/decidim/pages/_tabbed.html.erb +2 -2
- data/app/views/decidim/searches/_filters.html.erb +2 -2
- data/app/views/decidim/shared/_filters.html.erb +2 -2
- data/app/views/decidim/shared/_orders.html.erb +2 -2
- data/app/views/decidim/shared/filters/_collection.html.erb +5 -3
- data/app/views/decidim/shared/filters/_dropdown_label.html.erb +21 -19
- data/app/views/layouts/decidim/_head.html.erb +1 -0
- data/app/views/layouts/decidim/_js_configuration.html.erb +3 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
- data/app/views/layouts/decidim/footer/_main_links.html.erb +3 -1
- data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +5 -5
- data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
- data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +4 -2
- data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
- data/config/assets.rb +1 -0
- data/config/locales/ar.yml +60 -8
- data/config/locales/bg.yml +909 -2
- data/config/locales/ca.yml +31 -24
- data/config/locales/cs.yml +7 -3
- data/config/locales/de.yml +37 -30
- data/config/locales/el.yml +11 -7
- data/config/locales/en.yml +10 -3
- data/config/locales/es-MX.yml +17 -10
- data/config/locales/es-PY.yml +17 -10
- data/config/locales/es.yml +59 -52
- data/config/locales/eu.yml +26 -10
- data/config/locales/fi-plain.yml +11 -4
- data/config/locales/fi.yml +14 -7
- data/config/locales/fr-CA.yml +14 -7
- data/config/locales/fr.yml +14 -7
- data/config/locales/ga-IE.yml +9 -0
- data/config/locales/gl.yml +5 -2
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +264 -8
- data/config/locales/id-ID.yml +0 -2
- data/config/locales/it.yml +9 -6
- data/config/locales/ja.yml +14 -7
- data/config/locales/kaa.yml +5 -0
- data/config/locales/lb.yml +9 -6
- data/config/locales/lt.yml +8 -12
- data/config/locales/lv.yml +8 -3
- data/config/locales/nl.yml +8 -3
- data/config/locales/no.yml +9 -6
- data/config/locales/pl.yml +616 -2
- data/config/locales/pt-BR.yml +202 -19
- data/config/locales/pt.yml +9 -6
- data/config/locales/ro-RO.yml +10 -5
- data/config/locales/ru.yml +15 -2
- data/config/locales/sk.yml +8 -3
- data/config/locales/sl.yml +8 -0
- data/config/locales/sv.yml +32 -6
- data/config/locales/tr-TR.yml +24 -9
- data/config/locales/uk.yml +22 -2
- data/config/locales/zh-CN.yml +0 -6
- data/config/locales/zh-TW.yml +10 -11
- data/decidim-core.gemspec +90 -0
- data/lib/decidim/asset_router/storage.rb +2 -0
- data/lib/decidim/attribute_encryptor.rb +6 -4
- data/lib/decidim/attributes/time_with_zone.rb +1 -1
- data/lib/decidim/core/engine.rb +7 -6
- data/lib/decidim/core/seeds.rb +37 -33
- data/lib/decidim/core/test/factories.rb +296 -89
- 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 +76 -6
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +8 -8
- 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 -1
- data/lib/decidim/core/test/shared_examples/logo_email.rb +2 -2
- data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -0
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +5 -2
- data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
- data/lib/decidim/core/test/shared_examples/simple_event.rb +18 -2
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +7 -1
- data/lib/decidim/engine_router.rb +17 -4
- data/lib/decidim/events/base_event.rb +7 -3
- data/lib/decidim/events/simple_event.rb +3 -17
- data/lib/decidim/form_builder.rb +8 -2
- data/lib/decidim/has_category.rb +1 -1
- data/lib/decidim/has_conversations.rb +91 -0
- data/lib/decidim/organization_settings.rb +10 -2
- data/lib/decidim/participable.rb +17 -0
- data/lib/decidim/upgrade/wysiwyg_migrator.rb +7 -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 +26 -27
- data/app/views/decidim/searches/index.js.erb +0 -7
- data/config/brakeman.ignore +0 -37
- data/config/environment.rb +0 -3
@@ -9,8 +9,39 @@ require "decidim/participatory_processes/test/factories"
|
|
9
9
|
require "decidim/assemblies/test/factories"
|
10
10
|
require "decidim/comments/test/factories"
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def generate_component_name(locales, manifest_name, skip_injection: false)
|
13
|
+
prepend = skip_injection ? "" : "<script>alert(\"#{manifest_name}\");</script>"
|
14
|
+
|
15
|
+
Decidim::Components::Namer.new(locales, manifest_name).i18n_name.transform_values { |v| [prepend, v].compact_blank.join(" ") }
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_localized_description(field = nil, skip_injection: false, before: "<p>", after: "</p>")
|
19
|
+
Decidim::Faker::Localized.wrapped(before, after) do
|
20
|
+
generate_localized_title(field, skip_injection:)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_localized_word(field = nil, skip_injection: false)
|
25
|
+
skip_injection = true if field.nil?
|
26
|
+
Decidim::Faker::Localized.localized do
|
27
|
+
if skip_injection
|
28
|
+
Faker::Lorem.word
|
29
|
+
else
|
30
|
+
"<script>alert(\"#{field}\");</script> #{Faker::Lorem.word}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate_localized_title(field = nil, skip_injection: false)
|
36
|
+
skip_injection = true if field.nil?
|
37
|
+
|
38
|
+
Decidim::Faker::Localized.localized do
|
39
|
+
if skip_injection
|
40
|
+
generate(:title)
|
41
|
+
else
|
42
|
+
"<script>alert(\"#{field}\");</script> #{generate(:title)}"
|
43
|
+
end
|
44
|
+
end
|
14
45
|
end
|
15
46
|
|
16
47
|
FactoryBot.define do
|
@@ -55,21 +86,29 @@ FactoryBot.define do
|
|
55
86
|
end
|
56
87
|
|
57
88
|
factory :category, class: "Decidim::Category" do
|
58
|
-
|
59
|
-
|
89
|
+
transient do
|
90
|
+
skip_injection { false }
|
91
|
+
end
|
92
|
+
|
93
|
+
name { generate_localized_title(:category_name, skip_injection:) }
|
94
|
+
description { generate_localized_description(:category_description, skip_injection:) }
|
60
95
|
weight { 0 }
|
61
96
|
|
62
97
|
association :participatory_space, factory: :participatory_process
|
63
98
|
end
|
64
99
|
|
65
100
|
factory :subcategory, parent: :category do
|
66
|
-
|
101
|
+
transient do
|
102
|
+
skip_injection { false }
|
103
|
+
end
|
104
|
+
parent { build(:category, skip_injection:) }
|
67
105
|
|
68
106
|
participatory_space { parent.participatory_space }
|
69
107
|
end
|
70
108
|
|
71
109
|
factory :organization, class: "Decidim::Organization" do
|
72
110
|
transient do
|
111
|
+
skip_injection { false }
|
73
112
|
create_static_pages { true }
|
74
113
|
end
|
75
114
|
|
@@ -82,7 +121,7 @@ FactoryBot.define do
|
|
82
121
|
youtube_handler { Faker::Hipster.word }
|
83
122
|
github_handler { Faker::Hipster.word }
|
84
123
|
sequence(:host) { |n| "#{n}.lvh.me" }
|
85
|
-
description {
|
124
|
+
description { generate_localized_description(:organization_description, skip_injection:) }
|
86
125
|
favicon { Decidim::Dev.test_file("icon.png", "image/png") }
|
87
126
|
default_locale { Decidim.default_locale }
|
88
127
|
available_locales { Decidim.available_locales }
|
@@ -95,7 +134,7 @@ FactoryBot.define do
|
|
95
134
|
user_groups_enabled { true }
|
96
135
|
send_welcome_notification { true }
|
97
136
|
comments_max_length { 1000 }
|
98
|
-
admin_terms_of_service_body {
|
137
|
+
admin_terms_of_service_body { generate_localized_description(:admin_terms_of_service_body, skip_injection:) }
|
99
138
|
force_users_to_authenticate_before_access_organization { false }
|
100
139
|
machine_translation_display_priority { "original" }
|
101
140
|
external_domain_whitelist { ["example.org", "twitter.com", "facebook.com", "youtube.com", "github.com", "mytesturl.me"] }
|
@@ -126,12 +165,15 @@ FactoryBot.define do
|
|
126
165
|
after(:create) do |organization, evaluator|
|
127
166
|
if evaluator.create_static_pages
|
128
167
|
tos_page = Decidim::StaticPage.find_by(slug: "terms-of-service", organization:)
|
129
|
-
create(:static_page, :tos, organization:) if tos_page.nil?
|
168
|
+
create(:static_page, :tos, organization:, skip_injection: evaluator.skip_injection) if tos_page.nil?
|
130
169
|
end
|
131
170
|
end
|
132
171
|
end
|
133
172
|
|
134
173
|
factory :user, class: "Decidim::User" do
|
174
|
+
transient do
|
175
|
+
skip_injection { false }
|
176
|
+
end
|
135
177
|
email { generate(:email) }
|
136
178
|
name { generate(:name) }
|
137
179
|
nickname { generate(:nickname) }
|
@@ -140,7 +182,7 @@ FactoryBot.define do
|
|
140
182
|
tos_agreement { "1" }
|
141
183
|
avatar { Decidim::Dev.test_file("avatar.jpg", "image/jpeg") }
|
142
184
|
personal_url { Faker::Internet.url }
|
143
|
-
about {
|
185
|
+
about { generate_localized_title(:user_about, skip_injection:) }
|
144
186
|
confirmation_sent_at { Time.current }
|
145
187
|
accepted_tos_version { organization.tos_version }
|
146
188
|
notifications_sending_frequency { "real_time" }
|
@@ -188,7 +230,7 @@ FactoryBot.define do
|
|
188
230
|
|
189
231
|
trait :officialized do
|
190
232
|
officialized_at { Time.current }
|
191
|
-
officialized_as { generate_localized_title }
|
233
|
+
officialized_as { generate_localized_title(:officialized_as, skip_injection:) }
|
192
234
|
end
|
193
235
|
|
194
236
|
after(:build) do |user, evaluator|
|
@@ -200,17 +242,24 @@ FactoryBot.define do
|
|
200
242
|
end
|
201
243
|
|
202
244
|
factory :participatory_space_private_user, class: "Decidim::ParticipatorySpacePrivateUser" do
|
245
|
+
transient do
|
246
|
+
skip_injection { false }
|
247
|
+
end
|
203
248
|
user
|
204
|
-
privatable_to { create(:participatory_process, organization: user.organization) }
|
249
|
+
privatable_to { create(:participatory_process, organization: user.organization, skip_injection:) }
|
205
250
|
end
|
206
251
|
|
207
252
|
factory :assembly_private_user, class: "Decidim::ParticipatorySpacePrivateUser" do
|
253
|
+
transient do
|
254
|
+
skip_injection { false }
|
255
|
+
end
|
208
256
|
user
|
209
|
-
privatable_to { create(:assembly, organization: user.organization) }
|
257
|
+
privatable_to { create(:assembly, organization: user.organization, skip_injection:) }
|
210
258
|
end
|
211
259
|
|
212
260
|
factory :user_group, class: "Decidim::UserGroup" do
|
213
261
|
transient do
|
262
|
+
skip_injection { false }
|
214
263
|
document_number { "#{Faker::Number.number(digits: 8)}X" }
|
215
264
|
phone { Faker::PhoneNumber.phone_number }
|
216
265
|
rejected_at { nil }
|
@@ -220,7 +269,7 @@ FactoryBot.define do
|
|
220
269
|
sequence(:name) { |n| "#{Faker::Company.name} #{n}" }
|
221
270
|
email { generate(:user_group_email) }
|
222
271
|
nickname { generate(:nickname) }
|
223
|
-
about {
|
272
|
+
about { generate_localized_title(:user_group_about, skip_injection:) }
|
224
273
|
organization
|
225
274
|
avatar { Decidim::Dev.test_file("avatar.jpg", "image/jpeg") } # Keep after organization
|
226
275
|
|
@@ -261,21 +310,27 @@ FactoryBot.define do
|
|
261
310
|
next if users.empty?
|
262
311
|
|
263
312
|
creator = users.shift
|
264
|
-
create(:user_group_membership, user: creator, user_group:, role: :creator)
|
313
|
+
create(:user_group_membership, user: creator, user_group:, role: :creator, skip_injection: evaluator.skip_injection)
|
265
314
|
|
266
315
|
users.each do |user|
|
267
|
-
create(:user_group_membership, user:, user_group:, role: :admin)
|
316
|
+
create(:user_group_membership, user:, user_group:, role: :admin, skip_injection: evaluator.skip_injection)
|
268
317
|
end
|
269
318
|
end
|
270
319
|
end
|
271
320
|
|
272
321
|
factory :user_group_membership, class: "Decidim::UserGroupMembership" do
|
273
|
-
|
322
|
+
transient do
|
323
|
+
skip_injection { false }
|
324
|
+
end
|
325
|
+
user { create(:user, :confirmed, organization: user_group.organization, skip_injection:) }
|
274
326
|
role { :creator }
|
275
327
|
user_group
|
276
328
|
end
|
277
329
|
|
278
330
|
factory :identity, class: "Decidim::Identity" do
|
331
|
+
transient do
|
332
|
+
skip_injection { false }
|
333
|
+
end
|
279
334
|
provider { "facebook" }
|
280
335
|
sequence(:uid)
|
281
336
|
user
|
@@ -283,6 +338,9 @@ FactoryBot.define do
|
|
283
338
|
end
|
284
339
|
|
285
340
|
factory :authorization, class: "Decidim::Authorization" do
|
341
|
+
transient do
|
342
|
+
skip_injection { false }
|
343
|
+
end
|
286
344
|
sequence(:name) { |n| "dummy_authorization_#{n}" }
|
287
345
|
user
|
288
346
|
metadata { {} }
|
@@ -299,37 +357,42 @@ FactoryBot.define do
|
|
299
357
|
|
300
358
|
factory :authorization_transfer, class: "Decidim::AuthorizationTransfer" do
|
301
359
|
transient do
|
302
|
-
|
360
|
+
skip_injection { false }
|
361
|
+
organization { create(:organization, skip_injection:) }
|
303
362
|
end
|
304
363
|
|
305
|
-
user { create(:user, :confirmed, organization:) }
|
306
|
-
source_user { create(:user, :confirmed, :deleted, organization: user.try(:organization) || organization) }
|
364
|
+
user { create(:user, :confirmed, organization:, skip_injection:) }
|
365
|
+
source_user { create(:user, :confirmed, :deleted, organization: user.try(:organization) || organization, skip_injection:) }
|
307
366
|
authorization do
|
308
367
|
create(
|
309
368
|
:authorization,
|
310
|
-
user: source_user || create(:user, :confirmed, :deleted, organization: user.try(:organization) || organization)
|
369
|
+
user: source_user || create(:user, :confirmed, :deleted, organization: user.try(:organization) || organization, skip_injection:)
|
311
370
|
)
|
312
371
|
end
|
313
372
|
|
314
373
|
trait :transferred do
|
315
|
-
authorization { create(:authorization, user:) }
|
374
|
+
authorization { create(:authorization, user:, skip_injection:) }
|
316
375
|
end
|
317
376
|
end
|
318
377
|
|
319
378
|
factory :authorization_transfer_record, class: "Decidim::AuthorizationTransferRecord" do
|
320
379
|
transient do
|
321
|
-
|
380
|
+
skip_injection { false }
|
381
|
+
organization { resource.try(:organization) || create(:organization, skip_injection:) }
|
322
382
|
end
|
323
383
|
|
324
|
-
transfer { create(:authorization_transfer, organization:) }
|
325
|
-
resource { create(:dummy_resource) }
|
384
|
+
transfer { create(:authorization_transfer, organization:, skip_injection:) }
|
385
|
+
resource { create(:dummy_resource, skip_injection:) }
|
326
386
|
end
|
327
387
|
|
328
388
|
factory :static_page, class: "Decidim::StaticPage" do
|
389
|
+
transient do
|
390
|
+
skip_injection { false }
|
391
|
+
end
|
329
392
|
slug { generate(:slug) }
|
330
|
-
title { generate_localized_title }
|
331
|
-
content {
|
332
|
-
organization { build(:organization) }
|
393
|
+
title { generate_localized_title(:static_page_title, skip_injection:) }
|
394
|
+
content { generate_localized_description(:static_page_content, skip_injection:) }
|
395
|
+
organization { build(:organization, skip_injection:) }
|
333
396
|
allow_public_access { false }
|
334
397
|
|
335
398
|
trait :default do
|
@@ -345,8 +408,8 @@ FactoryBot.define do
|
|
345
408
|
end
|
346
409
|
|
347
410
|
trait :with_topic do
|
348
|
-
after(:create) do |static_page|
|
349
|
-
topic = create(:static_page_topic, organization: static_page.organization)
|
411
|
+
after(:create) do |static_page, evaluator|
|
412
|
+
topic = create(:static_page_topic, organization: static_page.organization, skip_injection: evaluator.skip_injection)
|
350
413
|
static_page.topic = topic
|
351
414
|
static_page.save
|
352
415
|
end
|
@@ -354,24 +417,33 @@ FactoryBot.define do
|
|
354
417
|
end
|
355
418
|
|
356
419
|
factory :static_page_topic, class: "Decidim::StaticPageTopic" do
|
357
|
-
|
358
|
-
|
420
|
+
transient do
|
421
|
+
skip_injection { false }
|
422
|
+
end
|
423
|
+
title { generate_localized_title(:static_page_topic_title, skip_injection:) }
|
424
|
+
description { generate_localized_description(:static_page_topic_description, skip_injection:) }
|
359
425
|
organization
|
360
426
|
end
|
361
427
|
|
362
428
|
factory :attachment_collection, class: "Decidim::AttachmentCollection" do
|
363
|
-
|
364
|
-
|
429
|
+
transient do
|
430
|
+
skip_injection { false }
|
431
|
+
end
|
432
|
+
name { generate_localized_title(:attachment_collection_name, skip_injection:) }
|
433
|
+
description { generate_localized_title(:attachment_collection_description, skip_injection:) }
|
365
434
|
weight { Faker::Number.number(digits: 1) }
|
366
435
|
|
367
436
|
association :collection_for, factory: :participatory_process
|
368
437
|
end
|
369
438
|
|
370
439
|
factory :attachment, class: "Decidim::Attachment" do
|
371
|
-
|
372
|
-
|
440
|
+
transient do
|
441
|
+
skip_injection { false }
|
442
|
+
end
|
443
|
+
title { generate_localized_title(:attachment_title, skip_injection:) }
|
444
|
+
description { generate_localized_title(:attachment_description, skip_injection:) }
|
373
445
|
weight { Faker::Number.number(digits: 1) }
|
374
|
-
attached_to { build(:participatory_process) }
|
446
|
+
attached_to { build(:participatory_process, skip_injection:) }
|
375
447
|
content_type { "image/jpeg" }
|
376
448
|
file { Decidim::Dev.test_file("city.jpeg", "image/jpeg") } # Keep after attached_to
|
377
449
|
file_size { 108_908 }
|
@@ -389,23 +461,24 @@ FactoryBot.define do
|
|
389
461
|
|
390
462
|
factory :component, class: "Decidim::Component" do
|
391
463
|
transient do
|
392
|
-
|
464
|
+
skip_injection { false }
|
465
|
+
organization { create(:organization, skip_injection:) }
|
393
466
|
end
|
394
467
|
|
395
|
-
name { generate_localized_title }
|
396
|
-
participatory_space { create(:participatory_process, organization:) }
|
468
|
+
name { generate_localized_title(:component_name, skip_injection:) }
|
469
|
+
participatory_space { create(:participatory_process, organization:, skip_injection:) }
|
397
470
|
manifest_name { "dummy" }
|
398
471
|
published_at { Time.current }
|
399
472
|
settings do
|
400
473
|
{
|
401
|
-
dummy_global_translatable_text: generate_localized_title,
|
474
|
+
dummy_global_translatable_text: generate_localized_title(:dummy_global_translatable_text, skip_injection:),
|
402
475
|
comments_max_length: participatory_space.organization.comments_max_length || organization.comments_max_length
|
403
476
|
}
|
404
477
|
end
|
405
478
|
|
406
479
|
default_step_settings do
|
407
480
|
{
|
408
|
-
dummy_step_translatable_text: generate_localized_title
|
481
|
+
dummy_step_translatable_text: generate_localized_title(:dummy_step_translatable_text, skip_injection:)
|
409
482
|
}
|
410
483
|
end
|
411
484
|
|
@@ -443,7 +516,8 @@ FactoryBot.define do
|
|
443
516
|
create(:participatory_process_step,
|
444
517
|
active: true,
|
445
518
|
end_date: 1.month.from_now,
|
446
|
-
participatory_process: participatory_space
|
519
|
+
participatory_process: participatory_space,
|
520
|
+
skip_injection:)
|
447
521
|
participatory_space.reload
|
448
522
|
participatory_space.steps.reload
|
449
523
|
end
|
@@ -486,20 +560,29 @@ FactoryBot.define do
|
|
486
560
|
end
|
487
561
|
|
488
562
|
factory :scope_type, class: "Decidim::ScopeType" do
|
489
|
-
|
563
|
+
transient do
|
564
|
+
skip_injection { false }
|
565
|
+
end
|
566
|
+
name { generate_localized_word(:scope_type_name, skip_injection:) }
|
490
567
|
plural { Decidim::Faker::Localized.literal(name.values.first.pluralize) }
|
491
568
|
organization
|
492
569
|
end
|
493
570
|
|
494
571
|
factory :scope, class: "Decidim::Scope" do
|
572
|
+
transient do
|
573
|
+
skip_injection { false }
|
574
|
+
end
|
495
575
|
name { Decidim::Faker::Localized.literal(generate(:scope_name)) }
|
496
576
|
code { generate(:scope_code) }
|
497
|
-
scope_type { create(:scope_type, organization:) }
|
498
|
-
organization { parent ? parent.organization : build(:organization) }
|
577
|
+
scope_type { create(:scope_type, organization:, skip_injection:) }
|
578
|
+
organization { parent ? parent.organization : build(:organization, skip_injection:) }
|
499
579
|
end
|
500
580
|
|
501
581
|
factory :subscope, parent: :scope do
|
502
|
-
|
582
|
+
transient do
|
583
|
+
skip_injection { false }
|
584
|
+
end
|
585
|
+
parent { build(:scope, skip_injection:) }
|
503
586
|
|
504
587
|
before(:create) do |object|
|
505
588
|
object.parent.save unless object.parent.persisted?
|
@@ -507,36 +590,49 @@ FactoryBot.define do
|
|
507
590
|
end
|
508
591
|
|
509
592
|
factory :area_type, class: "Decidim::AreaType" do
|
510
|
-
|
593
|
+
transient do
|
594
|
+
skip_injection { false }
|
595
|
+
end
|
596
|
+
name { generate_localized_word(:area_type_name, skip_injection:) }
|
511
597
|
plural { Decidim::Faker::Localized.literal(name.values.first.pluralize) }
|
512
598
|
organization
|
513
599
|
end
|
514
600
|
|
515
601
|
factory :area, class: "Decidim::Area" do
|
602
|
+
transient do
|
603
|
+
skip_injection { false }
|
604
|
+
end
|
516
605
|
name { Decidim::Faker::Localized.literal(generate(:area_name)) }
|
517
606
|
organization
|
518
607
|
end
|
519
608
|
|
520
609
|
factory :coauthorship, class: "Decidim::Coauthorship" do
|
521
|
-
|
610
|
+
transient do
|
611
|
+
skip_injection { false }
|
612
|
+
end
|
613
|
+
coauthorable { create(:dummy_resource, skip_injection:) }
|
522
614
|
transient do
|
523
615
|
organization { coauthorable.component.participatory_space.organization }
|
524
616
|
end
|
525
|
-
author { create(:user, :confirmed, organization:) }
|
617
|
+
author { create(:user, :confirmed, organization:, skip_injection:) }
|
526
618
|
end
|
527
619
|
|
528
620
|
factory :resource_link, class: "Decidim::ResourceLink" do
|
621
|
+
transient do
|
622
|
+
skip_injection { false }
|
623
|
+
end
|
529
624
|
name { generate(:slug) }
|
530
|
-
to { build(:dummy_resource) }
|
531
|
-
from { build(:dummy_resource, component: to.component) }
|
625
|
+
to { build(:dummy_resource, skip_injection:) }
|
626
|
+
from { build(:dummy_resource, component: to.component, skip_injection:) }
|
532
627
|
end
|
533
628
|
|
534
629
|
factory :newsletter, class: "Decidim::Newsletter" do
|
535
630
|
transient do
|
536
|
-
|
631
|
+
skip_injection { false }
|
632
|
+
body { generate_localized_description(:newsletter_body, skip_injection:) }
|
537
633
|
end
|
538
634
|
|
539
|
-
author { build(:user, :confirmed, organization:) }
|
635
|
+
author { build(:user, :confirmed, organization:, skip_injection:) }
|
540
636
|
organization
|
541
637
|
|
542
638
|
subject { generate_localized_title }
|
@@ -548,7 +644,8 @@ FactoryBot.define do
|
|
548
644
|
organization: evaluator.organization,
|
549
645
|
scoped_resource_id: newsletter.id,
|
550
646
|
manifest_name: "basic_only_text",
|
551
|
-
settings: evaluator.body.transform_keys { |key| "body_#{key}" }
|
647
|
+
settings: evaluator.body.transform_keys { |key| "body_#{key}" },
|
648
|
+
skip_injection: evaluator.skip_injection
|
552
649
|
)
|
553
650
|
end
|
554
651
|
|
@@ -558,7 +655,10 @@ FactoryBot.define do
|
|
558
655
|
end
|
559
656
|
|
560
657
|
factory :moderation, class: "Decidim::Moderation" do
|
561
|
-
|
658
|
+
transient do
|
659
|
+
skip_injection { false }
|
660
|
+
end
|
661
|
+
reportable { build(:dummy_resource, skip_injection:) }
|
562
662
|
participatory_space { reportable.component.participatory_space }
|
563
663
|
|
564
664
|
trait :hidden do
|
@@ -567,35 +667,47 @@ FactoryBot.define do
|
|
567
667
|
end
|
568
668
|
|
569
669
|
factory :report, class: "Decidim::Report" do
|
670
|
+
transient do
|
671
|
+
skip_injection { false }
|
672
|
+
end
|
570
673
|
moderation
|
571
|
-
user { build(:user, organization: moderation.reportable.organization) }
|
674
|
+
user { build(:user, organization: moderation.reportable.organization, skip_injection:) }
|
572
675
|
reason { "spam" }
|
573
676
|
end
|
574
677
|
|
575
678
|
factory :impersonation_log, class: "Decidim::ImpersonationLog" do
|
576
|
-
|
577
|
-
|
679
|
+
transient do
|
680
|
+
skip_injection { false }
|
681
|
+
end
|
682
|
+
admin { build(:user, :admin, skip_injection:) }
|
683
|
+
user { build(:user, :managed, organization: admin.organization, skip_injection:) }
|
578
684
|
started_at { 10.minutes.ago }
|
579
685
|
end
|
580
686
|
|
581
687
|
factory :follow, class: "Decidim::Follow" do
|
688
|
+
transient do
|
689
|
+
skip_injection { false }
|
690
|
+
end
|
582
691
|
user do
|
583
692
|
build(
|
584
693
|
:user,
|
585
|
-
organization: followable.try(:organization) || build(:organization)
|
694
|
+
organization: followable.try(:organization) || build(:organization, skip_injection:)
|
586
695
|
)
|
587
696
|
end
|
588
|
-
followable { build(:dummy_resource) }
|
697
|
+
followable { build(:dummy_resource, skip_injection:) }
|
589
698
|
end
|
590
699
|
|
591
700
|
factory :notification, class: "Decidim::Notification" do
|
701
|
+
transient do
|
702
|
+
skip_injection { false }
|
703
|
+
end
|
592
704
|
user do
|
593
705
|
build(
|
594
706
|
:user,
|
595
|
-
organization: resource.try(:organization) || build(:organization)
|
707
|
+
organization: resource.try(:organization) || build(:organization, skip_injection:)
|
596
708
|
)
|
597
709
|
end
|
598
|
-
resource { build(:dummy_resource) }
|
710
|
+
resource { build(:dummy_resource, skip_injection:) }
|
599
711
|
event_name { resource.class.name.underscore.tr("/", ".") }
|
600
712
|
event_class { "Decidim::Dev::DummyResourceEvent" }
|
601
713
|
extra do
|
@@ -605,16 +717,60 @@ FactoryBot.define do
|
|
605
717
|
end
|
606
718
|
end
|
607
719
|
|
720
|
+
factory :conversation, class: "Decidim::Messaging::Conversation" do
|
721
|
+
transient do
|
722
|
+
skip_injection { false }
|
723
|
+
end
|
724
|
+
|
725
|
+
originator { build(:user, skip_injection:) }
|
726
|
+
interlocutors { [build(:user, skip_injection:)] }
|
727
|
+
body { Faker::Lorem.sentence }
|
728
|
+
user
|
729
|
+
|
730
|
+
after(:create) do |object|
|
731
|
+
object.participants ||= [originator + interlocutors].flatten
|
732
|
+
end
|
733
|
+
|
734
|
+
initialize_with { Decidim::Messaging::Conversation.start(originator:, interlocutors:, body:, user:) }
|
735
|
+
end
|
736
|
+
|
737
|
+
factory :message, class: "Decidim::Messaging::Message" do
|
738
|
+
transient do
|
739
|
+
skip_injection { false }
|
740
|
+
end
|
741
|
+
|
742
|
+
body { generate_localized_description(:message_body, skip_injection:) }
|
743
|
+
conversation
|
744
|
+
|
745
|
+
before(:create) do |object|
|
746
|
+
object.sender ||= object.conversation.participants.take
|
747
|
+
end
|
748
|
+
end
|
749
|
+
|
750
|
+
factory :push_notification_message, class: "Decidim::PushNotificationMessage" do
|
751
|
+
transient do
|
752
|
+
skip_injection { false }
|
753
|
+
end
|
754
|
+
|
755
|
+
recipient { build(:user, skip_injection:) }
|
756
|
+
conversation { create(:conversation, skip_injection:) }
|
757
|
+
message { generate_localized_description(:push_notification_message_message, skip_injection:) }
|
758
|
+
|
759
|
+
skip_create
|
760
|
+
initialize_with { new(recipient:, conversation:, message:) }
|
761
|
+
end
|
762
|
+
|
608
763
|
factory :action_log, class: "Decidim::ActionLog" do
|
609
764
|
transient do
|
765
|
+
skip_injection { false }
|
610
766
|
extra_data { {} }
|
611
767
|
end
|
612
768
|
|
613
769
|
organization { user.organization }
|
614
770
|
user
|
615
|
-
participatory_space { build(:participatory_process, organization:) }
|
616
|
-
component { build(:component, participatory_space:) }
|
617
|
-
resource { build(:dummy_resource, component:) }
|
771
|
+
participatory_space { build(:participatory_process, organization:, skip_injection:) }
|
772
|
+
component { build(:component, participatory_space:, skip_injection:) }
|
773
|
+
resource { build(:dummy_resource, component:, skip_injection:) }
|
618
774
|
action { "create" }
|
619
775
|
visibility { "admin-only" }
|
620
776
|
extra do
|
@@ -640,6 +796,9 @@ FactoryBot.define do
|
|
640
796
|
end
|
641
797
|
|
642
798
|
factory :oauth_application, class: "Decidim::OAuthApplication" do
|
799
|
+
transient do
|
800
|
+
skip_injection { false }
|
801
|
+
end
|
643
802
|
organization
|
644
803
|
sequence(:name) { |n| "OAuth application #{n}" }
|
645
804
|
sequence(:organization_name) { |n| "OAuth application owner #{n}" }
|
@@ -650,8 +809,11 @@ FactoryBot.define do
|
|
650
809
|
end
|
651
810
|
|
652
811
|
factory :oauth_access_token, class: "Doorkeeper::AccessToken" do
|
653
|
-
|
654
|
-
|
812
|
+
transient do
|
813
|
+
skip_injection { false }
|
814
|
+
end
|
815
|
+
resource_owner_id { create(:user, organization: application.organization, skip_injection:).id }
|
816
|
+
application { build(:oauth_application, skip_injection:) }
|
655
817
|
token { SecureRandom.hex(32) }
|
656
818
|
expires_in { 1.month.from_now }
|
657
819
|
created_at { Time.current }
|
@@ -659,7 +821,10 @@ FactoryBot.define do
|
|
659
821
|
end
|
660
822
|
|
661
823
|
factory :searchable_resource, class: "Decidim::SearchableResource" do
|
662
|
-
|
824
|
+
transient do
|
825
|
+
skip_injection { false }
|
826
|
+
end
|
827
|
+
resource { build(:dummy_resource, skip_injection:) }
|
663
828
|
resource_id { resource.id }
|
664
829
|
resource_type { resource.class.name }
|
665
830
|
organization { resource.component.organization }
|
@@ -671,6 +836,9 @@ FactoryBot.define do
|
|
671
836
|
end
|
672
837
|
|
673
838
|
factory :content_block, class: "Decidim::ContentBlock" do
|
839
|
+
transient do
|
840
|
+
skip_injection { false }
|
841
|
+
end
|
674
842
|
organization
|
675
843
|
scope_name { :homepage }
|
676
844
|
manifest_name { :hero }
|
@@ -684,24 +852,33 @@ FactoryBot.define do
|
|
684
852
|
end
|
685
853
|
|
686
854
|
factory :hashtag, class: "Decidim::Hashtag" do
|
855
|
+
transient do
|
856
|
+
skip_injection { false }
|
857
|
+
end
|
687
858
|
name { generate(:hashtag_name) }
|
688
859
|
organization
|
689
860
|
end
|
690
861
|
|
691
862
|
factory :metric, class: "Decidim::Metric" do
|
863
|
+
transient do
|
864
|
+
skip_injection { false }
|
865
|
+
end
|
692
866
|
organization
|
693
867
|
day { Time.zone.today }
|
694
868
|
metric_type { "random_metric" }
|
695
869
|
cumulative { 2 }
|
696
870
|
quantity { 1 }
|
697
871
|
category { create(:category) }
|
698
|
-
participatory_space { create(:participatory_process, organization:) }
|
699
|
-
related_object { create(:component, participatory_space:) }
|
872
|
+
participatory_space { create(:participatory_process, organization:, skip_injection:) }
|
873
|
+
related_object { create(:component, participatory_space:, skip_injection:) }
|
700
874
|
end
|
701
875
|
|
702
876
|
factory :amendment, class: "Decidim::Amendment" do
|
703
|
-
|
704
|
-
|
877
|
+
transient do
|
878
|
+
skip_injection { false }
|
879
|
+
end
|
880
|
+
amendable { build(:dummy_resource, skip_injection:) }
|
881
|
+
emendation { build(:dummy_resource, skip_injection:) }
|
705
882
|
amender { emendation.try(:creator_author) || emendation.try(:author) }
|
706
883
|
state { "evaluating" }
|
707
884
|
|
@@ -713,29 +890,44 @@ FactoryBot.define do
|
|
713
890
|
end
|
714
891
|
|
715
892
|
factory :user_report, class: "Decidim::UserReport" do
|
893
|
+
transient do
|
894
|
+
skip_injection { false }
|
895
|
+
end
|
716
896
|
reason { "spam" }
|
717
|
-
moderation { create(:user_moderation, user:) }
|
897
|
+
moderation { create(:user_moderation, user:, skip_injection:) }
|
718
898
|
user { build(:user) }
|
719
899
|
end
|
720
900
|
|
721
901
|
factory :user_moderation, class: "Decidim::UserModeration" do
|
902
|
+
transient do
|
903
|
+
skip_injection { false }
|
904
|
+
end
|
722
905
|
user { build(:user) }
|
723
906
|
end
|
724
907
|
|
725
908
|
factory :endorsement, class: "Decidim::Endorsement" do
|
726
|
-
|
727
|
-
|
909
|
+
transient do
|
910
|
+
skip_injection { false }
|
911
|
+
end
|
912
|
+
resource { build(:dummy_resource, skip_injection:) }
|
913
|
+
author { resource.try(:creator_author) || resource.try(:author) || build(:user, organization: resource.organization, skip_injection:) }
|
728
914
|
end
|
729
915
|
|
730
916
|
factory :user_group_endorsement, class: "Decidim::Endorsement" do
|
731
|
-
|
732
|
-
|
733
|
-
|
917
|
+
transient do
|
918
|
+
skip_injection { false }
|
919
|
+
end
|
920
|
+
resource { build(:dummy_resource, skip_injection:) }
|
921
|
+
author { build(:user, organization: resource.organization, skip_injection:) }
|
922
|
+
user_group { create(:user_group, verified_at: Time.current, organization: resource.organization, users: [author], skip_injection:) }
|
734
923
|
end
|
735
924
|
|
736
925
|
factory :share_token, class: "Decidim::ShareToken" do
|
737
|
-
|
738
|
-
|
926
|
+
transient do
|
927
|
+
skip_injection { false }
|
928
|
+
end
|
929
|
+
token_for { build(:component, skip_injection:) }
|
930
|
+
user { build(:user, organization: token_for.organization, skip_injection:) }
|
739
931
|
|
740
932
|
before(:create) do |object|
|
741
933
|
object.organization ||= object.token_for.organization
|
@@ -752,19 +944,28 @@ FactoryBot.define do
|
|
752
944
|
end
|
753
945
|
|
754
946
|
factory :editor_image, class: "Decidim::EditorImage" do
|
947
|
+
transient do
|
948
|
+
skip_injection { false }
|
949
|
+
end
|
755
950
|
organization
|
756
|
-
author { create(:user, :admin, :confirmed, organization:) }
|
951
|
+
author { create(:user, :admin, :confirmed, organization:, skip_injection:) }
|
757
952
|
file { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }
|
758
953
|
end
|
759
954
|
|
760
955
|
factory :reminder, class: "Decidim::Reminder" do
|
761
|
-
|
762
|
-
|
956
|
+
transient do
|
957
|
+
skip_injection { false }
|
958
|
+
end
|
959
|
+
user { build(:user, skip_injection:) }
|
960
|
+
component { build(:dummy_component, organization: user.organization, skip_injection:) }
|
763
961
|
end
|
764
962
|
|
765
963
|
factory :reminder_record, class: "Decidim::ReminderRecord" do
|
766
|
-
|
767
|
-
|
964
|
+
transient do
|
965
|
+
skip_injection { false }
|
966
|
+
end
|
967
|
+
reminder { create(:reminder, skip_injection:) }
|
968
|
+
remindable { build(:dummy_resource, skip_injection:) }
|
768
969
|
|
769
970
|
Decidim::ReminderRecord::STATES.keys.each do |defined_state|
|
770
971
|
trait defined_state do
|
@@ -774,17 +975,23 @@ FactoryBot.define do
|
|
774
975
|
end
|
775
976
|
|
776
977
|
factory :reminder_delivery, class: "Decidim::ReminderDelivery" do
|
777
|
-
|
978
|
+
transient do
|
979
|
+
skip_injection { false }
|
980
|
+
end
|
981
|
+
reminder { create(:reminder, skip_injection:) }
|
778
982
|
end
|
779
983
|
|
780
984
|
factory :short_link, class: "Decidim::ShortLink" do
|
781
|
-
|
985
|
+
transient do
|
986
|
+
skip_injection { false }
|
987
|
+
end
|
988
|
+
target { create(:component, manifest_name: "dummy", skip_injection:) }
|
782
989
|
route_name { nil }
|
783
990
|
params { {} }
|
784
991
|
|
785
|
-
before(:create) do |object|
|
992
|
+
before(:create) do |object, evaluator|
|
786
993
|
object.organization ||= object.target if object.target.is_a?(Decidim::Organization)
|
787
|
-
object.organization ||= object.target.try(:organization) || create(:organization)
|
994
|
+
object.organization ||= object.target.try(:organization) || create(:organization, skip_injection: evaluator.skip_injection)
|
788
995
|
object.identifier ||= Decidim::ShortLink.unique_identifier_within(object.organization)
|
789
996
|
object.mounted_engine_name ||=
|
790
997
|
if object.target.respond_to?(:participatory_space)
|