Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra user fields #426

Merged
merged 11 commits into from
Sep 4, 2023
Merged
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
35 changes: 29 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1094,4 +1117,4 @@ RUBY VERSION
ruby 3.0.6p216

BUNDLED WITH
2.4.9
2.2.33
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion spec/commands/decidim/create_registration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down