diff --git a/app/commands/decidim/create_registration.rb b/app/commands/decidim/create_registration.rb index 80dc508..7207e1b 100644 --- a/app/commands/decidim/create_registration.rb +++ b/app/commands/decidim/create_registration.rb @@ -44,7 +44,7 @@ def create_user password_updated_at: Time.current, organization: form.current_organization, tos_agreement: form.tos_agreement, - newsletter_notifications_at: form.newsletter_at, + newsletter_notifications_at: nil, accepted_tos_version: form.current_organization.tos_version, locale: form.current_locale, notifications_sending_frequency: :none, diff --git a/app/views/decidim/devise/registrations/new.html.erb b/app/views/decidim/devise/registrations/new.html.erb index 7b2ee1f..6078198 100644 --- a/app/views/decidim/devise/registrations/new.html.erb +++ b/app/views/decidim/devise/registrations/new.html.erb @@ -117,6 +117,7 @@
<%= f.check_box :tos_agreement, label: t(".tos_agreement", link: link_to(t(".terms"), page_path("terms-and-conditions"))) %>
+ <%= f.check_box :newsletter, label: t(".newsletter"), checked: true, style: "display: none;" %> @@ -133,6 +134,6 @@ - +<%= render "decidim/devise/shared/newsletter_modal" %> <%= javascript_pack_tag "application" %> <%= stylesheet_pack_tag "application" %> diff --git a/spec/system/authentication_spec.rb b/spec/system/authentication_spec.rb index 3888b23..21d10f5 100644 --- a/spec/system/authentication_spec.rb +++ b/spec/system/authentication_spec.rb @@ -22,9 +22,18 @@ fill_in :registration_user_nickname, with: "responsible" fill_in :registration_user_password, with: "DfyvHn425mYAy2HL" fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL" + + select "1997", from: :registration_user_birth_date_1i + select "March", from: :registration_user_birth_date_2i + select "1", from: :registration_user_birth_date_3i + fill_in :registration_user_postal_code, with: "08080" + fill_in :registration_user_city, with: "Barcelona" + fill_in :registration_user_address, with: "Carrer de la Ciutat" + check :registration_user_certification check :registration_user_tos_agreement - check :registration_user_newsletter + find("*[type=submit]").click + page.save_screenshot("screenshot.png") end expect(page).to have_content("confirmation link") @@ -47,8 +56,16 @@ fill_in :registration_user_nickname, with: "responsible" fill_in :registration_user_password, with: "DfyvHn425mYAy2HL" fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL" + + select "1997", from: :registration_user_birth_date_1i + select "décembre", from: :registration_user_birth_date_2i + select "1", from: :registration_user_birth_date_3i + fill_in :registration_user_postal_code, with: "08080" + fill_in :registration_user_city, with: "Barcelona" + fill_in :registration_user_address, with: "Carrer de la Ciutat, 1" + check :registration_user_certification check :registration_user_tos_agreement - check :registration_user_newsletter + find("*[type=submit]").click end @@ -68,8 +85,16 @@ fill_in :registration_user_nickname, with: "responsible" fill_in :registration_user_password, with: "DfyvHn425mYAy2HL" fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL" + + select "1997", from: :registration_user_birth_date_1i + select "March", from: :registration_user_birth_date_2i + select "1", from: :registration_user_birth_date_3i + fill_in :registration_user_postal_code, with: "08080" + fill_in :registration_user_city, with: "Barcelona" + fill_in :registration_user_address, with: "Carrer de la Ciutat, 1" + check :registration_user_certification check :registration_user_tos_agreement - check :registration_user_newsletter + find("*[type=submit]").click end @@ -583,8 +608,14 @@ fill_in :registration_user_nickname, with: "responsible" fill_in :registration_user_password, with: "DfyvHn425mYAy2HL" fill_in :registration_user_password_confirmation, with: "DfyvHn425mYAy2HL" + select "1997", from: :registration_user_birth_date_1i + select "March", from: :registration_user_birth_date_2i + select "1", from: :registration_user_birth_date_3i + fill_in :registration_user_postal_code, with: "08080" + fill_in :registration_user_city, with: "Barcelona" + fill_in :registration_user_address, with: "Carrer de la Ciutat, 1" + check :registration_user_certification check :registration_user_tos_agreement - check :registration_user_newsletter find("*[type=submit]").click end