diff --git a/Gemfile b/Gemfile index 540dbcd12f..50b0539436 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem "decidim-cache_cleaner" gem "decidim-decidim_awesome" gem "decidim-extended_socio_demographic_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module-extended_socio_demographic_authorization_handler.git", branch: DECIDIM_BRANCH +gem "decidim-extra_user_fields", git: "https://github.com/paulinebessoles/decidim-module-extra_user_fields", branch: "feat/add_tests_0_27" gem "decidim-friendly_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git" # TODO: Bump to 0.27.0 when released # gem "decidim-gallery" diff --git a/Gemfile.lock b/Gemfile.lock index c7abf0c741..1840ab3988 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,9 +16,9 @@ GIT GIT remote: https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git - revision: e4a9120039f374936eb010b2431b3548a9ee0661 + revision: 9b8ece180ca97bf97c5d401a42a79b1dc4b8b536 specs: - decidim-friendly_signup (0.4.4) + decidim-friendly_signup (0.4.5) decidim-core (~> 0.27) GIT @@ -65,6 +65,16 @@ GIT decidim-admin (~> 0.27.0) decidim-core (~> 0.27.0) +GIT + remote: https://github.com/paulinebessoles/decidim-module-extra_user_fields + revision: 8fea55957c88073242026175d78aa4a0633e68e8 + branch: feat/add_tests_0_27 + specs: + decidim-extra_user_fields (0.27.2) + country_select (~> 4.0) + decidim-core (>= 0.27.0, < 0.28) + deface (~> 1.5) + GIT remote: https://github.com/sgruhier/foundation_rails_helper.git revision: bc33600db7a2d16ce3cdc1f8369d0d7e7c4245b5 @@ -151,7 +161,7 @@ GEM ast (2.4.2) attr_required (1.0.1) aws-eventstream (1.2.0) - aws-partitions (1.813.0) + aws-partitions (1.814.0) aws-sdk-core (3.181.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) @@ -241,10 +251,17 @@ GEM commonmarker (0.23.10) concurrent-ruby (1.2.2) connection_pool (2.4.1) + countries (3.1.0) + i18n_data (~> 0.11.0) + sixarm_ruby_unaccent (~> 1.1) + unicode_utils (~> 1.4) + country_select (4.0.0) + countries (~> 3.0) + sort_alphabetical (~> 1.0) crack (0.4.5) rexml crass (1.0.6) - css_parser (1.14.0) + css_parser (1.15.0) addressable dalli (3.2.5) date (3.3.3) @@ -574,6 +591,7 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) + i18n_data (0.11.0) icalendar (2.9.0) ice_cube (~> 0.16) ice_cube (0.16.4) @@ -935,12 +953,15 @@ GEM simplecov (~> 0.19) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) + sixarm_ruby_unaccent (1.2.2) smart_properties (1.17.0) snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) social-share-button (1.2.4) coffee-rails + sort_alphabetical (1.1.0) + unicode_utils (>= 1.2.2) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -971,6 +992,7 @@ GEM concurrent-ruby (~> 1.0) uber (0.1.0) unicode-display_width (2.4.2) + unicode_utils (1.4.0) valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) @@ -1003,7 +1025,7 @@ GEM webfinger (1.2.0) activesupport httpclient (>= 2.4) - webmock (3.19.0) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -1052,6 +1074,7 @@ DEPENDENCIES decidim-decidim_awesome decidim-dev (~> 0.27.0) decidim-extended_socio_demographic_authorization_handler! + decidim-extra_user_fields! decidim-friendly_signup! decidim-homepage_interactive_map! decidim-initiatives (~> 0.27.0) @@ -1094,4 +1117,4 @@ RUBY VERSION ruby 3.0.6p216 BUNDLED WITH - 2.4.9 + 2.2.33 diff --git a/db/migrate/20230831093832_add_extra_user_fields_to_decidim_organization.decidim_extra_user_fields.rb b/db/migrate/20230831093832_add_extra_user_fields_to_decidim_organization.decidim_extra_user_fields.rb new file mode 100644 index 0000000000..3a4ff4085d --- /dev/null +++ b/db/migrate/20230831093832_add_extra_user_fields_to_decidim_organization.decidim_extra_user_fields.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true +# This migration comes from decidim_extra_user_fields (originally 20221024121407) + +class AddExtraUserFieldsToDecidimOrganization < ActiveRecord::Migration[6.0] + def up + add_column :decidim_organizations, :extra_user_fields, :jsonb, default: { "enabled" => false } + end + + def down + remove_column :decidim_organizations, :extra_user_fields, :jsonb + end +end diff --git a/db/schema.rb b/db/schema.rb index 2b2572485c..386961c075 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_08_24_135807) do +ActiveRecord::Schema.define(version: 2023_08_31_093832) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -1331,6 +1331,7 @@ t.boolean "delete_inactive_users", default: false, null: false t.integer "delete_inactive_users_email_after" t.integer "delete_inactive_users_after" + t.jsonb "extra_user_fields", default: {"enabled"=>false} t.index ["host"], name: "index_decidim_organizations_on_host", unique: true t.index ["name"], name: "index_decidim_organizations_on_name", unique: true end diff --git a/spec/commands/decidim/create_registration_spec.rb b/spec/commands/decidim/create_registration_spec.rb index 61d524c69b..cc17492ad9 100644 --- a/spec/commands/decidim/create_registration_spec.rb +++ b/spec/commands/decidim/create_registration_spec.rb @@ -94,7 +94,15 @@ module Comments organization: organization, accepted_tos_version: organization.tos_version, locale: form.current_locale, - password_updated_at: an_instance_of(ActiveSupport::TimeWithZone) + password_updated_at: an_instance_of(ActiveSupport::TimeWithZone), + extended_data: { + country: nil, + date_of_birth: nil, + gender: nil, + location: nil, + phone_number: nil, + postal_code: nil + } ).and_call_original expect { command.call }.to change(User, :count).by(1)