Skip to content

Commit

Permalink
fix: Deactivate newsletter by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Dec 4, 2023
1 parent 3b849a2 commit 6ffaa7e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/commands/decidim/create_registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion app/views/decidim/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<div class="field">
<%= f.check_box :tos_agreement, label: t(".tos_agreement", link: link_to(t(".terms"), page_path("terms-and-conditions"))) %>
</div>
<%= f.check_box :newsletter, label: t(".newsletter"), checked: true, style: "display: none;" %>
</div>
</div>

Expand All @@ -133,6 +134,6 @@
</div>
</div>
</div>

<%= render "decidim/devise/shared/newsletter_modal" %>
<%= javascript_pack_tag "application" %>
<%= stylesheet_pack_tag "application" %>
39 changes: 35 additions & 4 deletions spec/system/authentication_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6ffaa7e

Please sign in to comment.