From 62b70f45bc2566d3ca3c0d79c72da7d46d5f49a4 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 17 Jan 2025 17:13:01 +0300 Subject: [PATCH 01/10] Add empty pd declaration page --- app/abilities/ability.rb | 2 +- .../accounts/pd_declarations_controller.rb | 12 ++++++++ .../accounts/pd_declarations/show.html.erb | 3 ++ config/locales/en.yml | 3 ++ config/routes.rb | 1 + .../pd_declarations_controller_test.rb | 29 +++++++++++++++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 app/controllers/accounts/pd_declarations_controller.rb create mode 100644 app/views/accounts/pd_declarations/show.html.erb create mode 100644 test/controllers/accounts/pd_declarations_controller_test.rb diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index e31e3e930..44b0ba93d 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -29,7 +29,7 @@ class Ability if user&.active? can :welcome, :site - can :read, [:deletion, :account_terms] + can :read, [:deletion, :account_terms, :account_pd_declaration] if Settings.status != "database_offline" can [:subscribe, :unsubscribe], Changeset diff --git a/app/controllers/accounts/pd_declarations_controller.rb b/app/controllers/accounts/pd_declarations_controller.rb new file mode 100644 index 000000000..3d90d250e --- /dev/null +++ b/app/controllers/accounts/pd_declarations_controller.rb @@ -0,0 +1,12 @@ +module Accounts + class PdDeclarationsController < ApplicationController + layout "site" + + before_action :authorize_web + before_action :set_locale + + authorize_resource :class => :account_pd_declaration + + def show; end + end +end diff --git a/app/views/accounts/pd_declarations/show.html.erb b/app/views/accounts/pd_declarations/show.html.erb new file mode 100644 index 000000000..ea8804640 --- /dev/null +++ b/app/views/accounts/pd_declarations/show.html.erb @@ -0,0 +1,3 @@ +<% content_for :heading do %> +

<%= t ".title" %>

+<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index a112f3b0d..861a15003 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -324,6 +324,9 @@ en: terms_declined_html: We are sorry that you have decided to not accept the new Contributor Terms. For more information, please see %{terms_declined_link}. terms_declined_link: this wiki page terms_declined_url: https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined + pd_declarations: + show: + title: Consider my contributions to be in the Public Domain browse: deleted_ago_by_html: "Deleted %{time_ago} by %{user}" edited_ago_by_html: "Edited %{time_ago} by %{user}" diff --git a/config/routes.rb b/config/routes.rb index 9e82a037d..4172069b9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -279,6 +279,7 @@ OpenStreetMap::Application.routes.draw do resource :account, :only => [:edit, :update, :destroy] do scope :module => :accounts do resource :terms, :only => [:show, :update] + resource :pd_declaration, :only => :show resource :deletion, :only => :show end end diff --git a/test/controllers/accounts/pd_declarations_controller_test.rb b/test/controllers/accounts/pd_declarations_controller_test.rb new file mode 100644 index 000000000..4b961e326 --- /dev/null +++ b/test/controllers/accounts/pd_declarations_controller_test.rb @@ -0,0 +1,29 @@ +require "test_helper" + +module Accounts + class PdDeclarationsControllerTest < ActionDispatch::IntegrationTest + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/account/pd_declaration", :method => :get }, + { :controller => "accounts/pd_declarations", :action => "show" } + ) + end + + def test_show_not_logged_in + get account_pd_declaration_path + + assert_redirected_to login_path(:referer => account_pd_declaration_path) + end + + def test_show_agreed + user = create(:user) + session_for(user) + + get account_pd_declaration_path + + assert_response :success + end + end +end From 4469c9f5e599ab4dc2e92c9240d261c0ab25fbb7 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 17 Jan 2025 17:43:52 +0300 Subject: [PATCH 02/10] Show checkbox on pd declaration page --- .../accounts/pd_declarations/show.html.erb | 8 ++++++ config/locales/en.yml | 1 + test/system/account_pd_declaration_test.rb | 26 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 test/system/account_pd_declaration_test.rb diff --git a/app/views/accounts/pd_declarations/show.html.erb b/app/views/accounts/pd_declarations/show.html.erb index ea8804640..6b8aaa609 100644 --- a/app/views/accounts/pd_declarations/show.html.erb +++ b/app/views/accounts/pd_declarations/show.html.erb @@ -1,3 +1,11 @@ <% content_for :heading do %>

<%= t ".title" %>

<% end %> + +<%= bootstrap_form_tag do |f| %> + <%= f.check_box :consider_pd, + :label => t(".consider_pd"), + :autocomplete => :off, + :checked => current_user.consider_pd, + :disabled => current_user.consider_pd %> +<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 861a15003..24d772da4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -327,6 +327,7 @@ en: pd_declarations: show: title: Consider my contributions to be in the Public Domain + consider_pd: "I consider my contributions to be in the Public Domain" browse: deleted_ago_by_html: "Deleted %{time_ago} by %{user}" edited_ago_by_html: "Edited %{time_ago} by %{user}" diff --git a/test/system/account_pd_declaration_test.rb b/test/system/account_pd_declaration_test.rb new file mode 100644 index 000000000..9471c28c1 --- /dev/null +++ b/test/system/account_pd_declaration_test.rb @@ -0,0 +1,26 @@ +require "application_system_test_case" + +class AccountPdDeclarationTest < ApplicationSystemTestCase + def setup + @user = create(:user, :display_name => "test user") + sign_in_as(@user) + end + + test "show checkbox if no declaration was made" do + visit account_pd_declaration_path + + within_content_body do + assert_unchecked_field "I consider my contributions to be in the Public Domain" + end + end + + test "show disabled checkbox if declaration was made" do + @user.update(:consider_pd => true) + + visit account_pd_declaration_path + + within_content_body do + assert_checked_field "I consider my contributions to be in the Public Domain", :disabled => true + end + end +end From f5f7985fdbef5c07e2833a834c774b209cebbc9e Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 17 Jan 2025 18:02:56 +0300 Subject: [PATCH 03/10] Add explanation link to pd declaration page --- app/views/accounts/pd_declarations/show.html.erb | 12 +++++++----- config/locales/en.yml | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/views/accounts/pd_declarations/show.html.erb b/app/views/accounts/pd_declarations/show.html.erb index 6b8aaa609..7832184dc 100644 --- a/app/views/accounts/pd_declarations/show.html.erb +++ b/app/views/accounts/pd_declarations/show.html.erb @@ -3,9 +3,11 @@ <% end %> <%= bootstrap_form_tag do |f| %> - <%= f.check_box :consider_pd, - :label => t(".consider_pd"), - :autocomplete => :off, - :checked => current_user.consider_pd, - :disabled => current_user.consider_pd %> + <%= f.form_group :help => link_to(t(".consider_pd_why"), t(".consider_pd_why_url"), :target => :new) do %> + <%= f.check_box :consider_pd, + :label => t(".consider_pd"), + :autocomplete => :off, + :checked => current_user.consider_pd, + :disabled => current_user.consider_pd %> + <% end %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 24d772da4..bfdf1c64f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -328,6 +328,8 @@ en: show: title: Consider my contributions to be in the Public Domain consider_pd: "I consider my contributions to be in the Public Domain" + consider_pd_why: "Why would I want my contributions to be Public Domain?" + consider_pd_why_url: https://osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain browse: deleted_ago_by_html: "Deleted %{time_ago} by %{user}" edited_ago_by_html: "Edited %{time_ago} by %{user}" From 0f51052e86db1e2d219633dd2c7260588257404d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 17 Jan 2025 18:09:47 +0300 Subject: [PATCH 04/10] Add confirm button to pd declaration page --- app/views/accounts/pd_declarations/show.html.erb | 1 + config/locales/en.yml | 1 + test/system/account_pd_declaration_test.rb | 2 ++ 3 files changed, 4 insertions(+) diff --git a/app/views/accounts/pd_declarations/show.html.erb b/app/views/accounts/pd_declarations/show.html.erb index 7832184dc..ad314feaa 100644 --- a/app/views/accounts/pd_declarations/show.html.erb +++ b/app/views/accounts/pd_declarations/show.html.erb @@ -10,4 +10,5 @@ :checked => current_user.consider_pd, :disabled => current_user.consider_pd %> <% end %> + <%= f.primary t(".confirm"), :disabled => current_user.consider_pd %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index bfdf1c64f..83e399fb6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -330,6 +330,7 @@ en: consider_pd: "I consider my contributions to be in the Public Domain" consider_pd_why: "Why would I want my contributions to be Public Domain?" consider_pd_why_url: https://osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain + confirm: Confirm browse: deleted_ago_by_html: "Deleted %{time_ago} by %{user}" edited_ago_by_html: "Edited %{time_ago} by %{user}" diff --git a/test/system/account_pd_declaration_test.rb b/test/system/account_pd_declaration_test.rb index 9471c28c1..22867c795 100644 --- a/test/system/account_pd_declaration_test.rb +++ b/test/system/account_pd_declaration_test.rb @@ -11,6 +11,7 @@ class AccountPdDeclarationTest < ApplicationSystemTestCase within_content_body do assert_unchecked_field "I consider my contributions to be in the Public Domain" + assert_button "Confirm" end end @@ -21,6 +22,7 @@ class AccountPdDeclarationTest < ApplicationSystemTestCase within_content_body do assert_checked_field "I consider my contributions to be in the Public Domain", :disabled => true + assert_button "Confirm", :disabled => true end end end From 7d6ac34fbcc86f9750ea4590043f12e24b76d057 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 17 Jan 2025 18:27:47 +0300 Subject: [PATCH 05/10] Add pd declaration create action --- app/abilities/ability.rb | 1 + .../accounts/pd_declarations_controller.rb | 4 ++++ config/routes.rb | 2 +- .../pd_declarations_controller_test.rb | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index 44b0ba93d..f46131454 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -38,6 +38,7 @@ class Ability can [:read, :create, :destroy], :oauth2_authorization can [:update, :destroy], :account can :update, :account_terms + can :create, :account_pd_declaration can :read, :dashboard can [:create, :subscribe, :unsubscribe], DiaryEntry can :update, DiaryEntry, :user => user diff --git a/app/controllers/accounts/pd_declarations_controller.rb b/app/controllers/accounts/pd_declarations_controller.rb index 3d90d250e..f6740f777 100644 --- a/app/controllers/accounts/pd_declarations_controller.rb +++ b/app/controllers/accounts/pd_declarations_controller.rb @@ -8,5 +8,9 @@ module Accounts authorize_resource :class => :account_pd_declaration def show; end + + def create + redirect_to edit_account_path + end end end diff --git a/config/routes.rb b/config/routes.rb index 4172069b9..aa2ae815b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -279,7 +279,7 @@ OpenStreetMap::Application.routes.draw do resource :account, :only => [:edit, :update, :destroy] do scope :module => :accounts do resource :terms, :only => [:show, :update] - resource :pd_declaration, :only => :show + resource :pd_declaration, :only => [:show, :create] resource :deletion, :only => :show end end diff --git a/test/controllers/accounts/pd_declarations_controller_test.rb b/test/controllers/accounts/pd_declarations_controller_test.rb index 4b961e326..d2bbd70d2 100644 --- a/test/controllers/accounts/pd_declarations_controller_test.rb +++ b/test/controllers/accounts/pd_declarations_controller_test.rb @@ -9,6 +9,10 @@ module Accounts { :path => "/account/pd_declaration", :method => :get }, { :controller => "accounts/pd_declarations", :action => "show" } ) + assert_routing( + { :path => "/account/pd_declaration", :method => :post }, + { :controller => "accounts/pd_declarations", :action => "create" } + ) end def test_show_not_logged_in @@ -25,5 +29,20 @@ module Accounts assert_response :success end + + def test_create_not_logged_in + post account_pd_declaration_path + + assert_response :forbidden + end + + def test_create + user = create(:user) + session_for(user) + + post account_pd_declaration_path + + assert_redirected_to edit_account_path + end end end From 6a75db52e44a587f1b96cdd0ca2b8b327f11958e Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 18 Jan 2025 03:03:13 +0300 Subject: [PATCH 06/10] Update user.consider_pd if confirmed --- .../accounts/pd_declarations_controller.rb | 12 +++++ config/locales/en.yml | 4 ++ .../pd_declarations_controller_test.rb | 46 ++++++++++++++++++- test/system/account_pd_declaration_test.rb | 20 +++++++- 4 files changed, 80 insertions(+), 2 deletions(-) diff --git a/app/controllers/accounts/pd_declarations_controller.rb b/app/controllers/accounts/pd_declarations_controller.rb index f6740f777..2d2569d62 100644 --- a/app/controllers/accounts/pd_declarations_controller.rb +++ b/app/controllers/accounts/pd_declarations_controller.rb @@ -10,6 +10,18 @@ module Accounts def show; end def create + if current_user.consider_pd + flash[:warning] = t(".already_declared") + else + current_user.consider_pd = params[:consider_pd] + + if current_user.consider_pd + flash[:notice] = t(".successfully_declared") if current_user.save + else + flash[:warning] = t(".did_not_confirm") + end + end + redirect_to edit_account_path end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 83e399fb6..874ecaa85 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -331,6 +331,10 @@ en: consider_pd_why: "Why would I want my contributions to be Public Domain?" consider_pd_why_url: https://osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain confirm: Confirm + create: + successfully_declared: "You have successfully declared that you consider your edits to be in the Public Domain." + already_declared: "You have already declared that you consider your edits to be in the Public Domain." + did_not_confirm: "You didn't confirm that you consider your edits to be in the Public Domain." browse: deleted_ago_by_html: "Deleted %{time_ago} by %{user}" edited_ago_by_html: "Edited %{time_ago} by %{user}" diff --git a/test/controllers/accounts/pd_declarations_controller_test.rb b/test/controllers/accounts/pd_declarations_controller_test.rb index d2bbd70d2..be0d46f1e 100644 --- a/test/controllers/accounts/pd_declarations_controller_test.rb +++ b/test/controllers/accounts/pd_declarations_controller_test.rb @@ -36,13 +36,57 @@ module Accounts assert_response :forbidden end - def test_create + def test_create_unconfirmed user = create(:user) session_for(user) post account_pd_declaration_path assert_redirected_to edit_account_path + assert_nil flash[:notice] + assert_equal "You didn't confirm that you consider your edits to be in the Public Domain.", flash[:warning] + + user.reload + assert_not_predicate user, :consider_pd + end + + def test_create_confirmed + user = create(:user) + session_for(user) + + post account_pd_declaration_path, :params => { :consider_pd => true } + + assert_equal "You have successfully declared that you consider your edits to be in the Public Domain.", flash[:notice] + assert_nil flash[:warning] + + user.reload + assert_predicate user, :consider_pd + end + + def test_create_already_declared_unconfirmed + user = create(:user, :consider_pd => true) + session_for(user) + + post account_pd_declaration_path + + assert_nil flash[:notice] + assert_equal "You have already declared that you consider your edits to be in the Public Domain.", flash[:warning] + + user.reload + assert_predicate user, :consider_pd + end + + def test_create_already_declared_confirmed + user = create(:user, :consider_pd => true) + session_for(user) + + post account_pd_declaration_path, :params => { :consider_pd => true } + + assert_nil flash[:notice] + assert_equal "You have already declared that you consider your edits to be in the Public Domain.", flash[:warning] + + user.reload + assert_predicate user, :consider_pd end end end diff --git a/test/system/account_pd_declaration_test.rb b/test/system/account_pd_declaration_test.rb index 22867c795..d58484c8c 100644 --- a/test/system/account_pd_declaration_test.rb +++ b/test/system/account_pd_declaration_test.rb @@ -6,12 +6,30 @@ class AccountPdDeclarationTest < ApplicationSystemTestCase sign_in_as(@user) end - test "show checkbox if no declaration was made" do + test "can decline declaration if no declaration was made" do visit account_pd_declaration_path within_content_body do assert_unchecked_field "I consider my contributions to be in the Public Domain" assert_button "Confirm" + + click_on "Confirm" + + assert_no_text "You have also declared that you consider your edits to be in the Public Domain." + end + end + + test "can confirm declaration if no declaration was made" do + visit account_pd_declaration_path + + within_content_body do + assert_unchecked_field "I consider my contributions to be in the Public Domain" + assert_button "Confirm" + + check "I consider my contributions to be in the Public Domain" + click_on "Confirm" + + assert_text "You have also declared that you consider your edits to be in the Public Domain." end end From 0e0ef1da265b21069b1894f99c243f0bbe7cae4f Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 18 Jan 2025 06:44:22 +0300 Subject: [PATCH 07/10] Use multiple lines in settings contributor terms section --- app/views/accounts/edit.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb index 7a10b12e3..2f336a330 100644 --- a/app/views/accounts/edit.html.erb +++ b/app/views/accounts/edit.html.erb @@ -29,13 +29,14 @@ (" target="_new"><%= t ".openid.link text" %>) -
- +
+ <% if current_user.terms_agreed? %> <%= t ".contributor terms.agreed" %> (" target="_new"><%= t ".contributor terms.link text" %>) <% if current_user.consider_pd? %> +
<%= t ".contributor terms.agreed_with_pd" %> <% end %> <% else %> From 7c551c5f73511931e555cd9e54971da175836234 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 18 Jan 2025 06:53:33 +0300 Subject: [PATCH 08/10] Add link from settings to pd declaration --- app/views/accounts/edit.html.erb | 5 ++++- config/locales/en.yml | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb index 2f336a330..ce7dd97a8 100644 --- a/app/views/accounts/edit.html.erb +++ b/app/views/accounts/edit.html.erb @@ -35,9 +35,12 @@ <% if current_user.terms_agreed? %> <%= t ".contributor terms.agreed" %> (" target="_new"><%= t ".contributor terms.link text" %>) +
<% if current_user.consider_pd? %> -
<%= t ".contributor terms.agreed_with_pd" %> + <% else %> + <%= t ".contributor terms.not_agreed_with_pd" %> + (<%= link_to t(".contributor terms.pd_link_text"), account_pd_declaration_path %>) <% end %> <% else %> <%= t ".contributor terms.not yet agreed" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 874ecaa85..5ea8abae2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -259,6 +259,8 @@ en: agreed_with_pd: "You have also declared that you consider your edits to be in the Public Domain." link: "https://osmfoundation.org/wiki/Licence/Contributor_Terms" link text: "what is this?" + not_agreed_with_pd: "You haven't declared that you consider your edits to be in the Public Domain." + pd_link_text: "declare" save changes button: Save Changes delete_account: Delete Account... go_public: From 9254f0c2be55435b6cb627aed667eb882db0280f Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 18 Jan 2025 07:11:41 +0300 Subject: [PATCH 09/10] Remove pd checkbox from signup page --- app/controllers/users_controller.rb | 3 +- app/views/users/new.html.erb | 10 +----- config/locales/en.yml | 3 -- test/integration/user_creation_test.rb | 48 +++++++++----------------- 4 files changed, 18 insertions(+), 46 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a0be87bdc..0df971bd4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -222,8 +222,7 @@ class UsersController < ApplicationController def user_params params.require(:user).permit(:email, :display_name, :auth_provider, :auth_uid, - :pass_crypt, :pass_crypt_confirmation, - :consider_pd) + :pass_crypt, :pass_crypt_confirmation) end ## diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 37493418a..22db279d9 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -78,17 +78,9 @@ :contributor_terms_link => link_to(t(".by_signing_up.contributor_terms"), t(".by_signing_up.contributor_terms_url"), :target => :new)) %>

- <%= f.form_group do %> - <%= f.check_box :consider_pd, - :tabindex => 5, - :label => t(".consider_pd_html", - :consider_pd_link => link_to(t(".consider_pd"), - t(".consider_pd_url"), - :target => :new)) %> - <% end %>
- <%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :class => "btn btn-primary", :tabindex => 6) %> + <%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :class => "btn btn-primary", :tabindex => 5) %>
<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 5ea8abae2..c802f2ab8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2787,9 +2787,6 @@ en: privacy_policy_url: https://osmfoundation.org/wiki/Privacy_Policy privacy_policy_title: OSMF privacy policy including section on email addresses html: 'Your address is not displayed publicly, see our %{privacy_policy_link} for more information.' - consider_pd_html: "I consider my contributions to be in the %{consider_pd_link}." - consider_pd: "public domain" - consider_pd_url: https://osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain or: "or" use external auth: "or sign up with a third party" no_such_user: diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index 1a53f62da..5d75c508d 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -34,8 +34,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => dup_email, :display_name => display_name, :pass_crypt => "testtest", - :pass_crypt_confirmation => "testtest", - :consider_pd => "1" } } + :pass_crypt_confirmation => "testtest" } } end end end @@ -57,8 +56,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :pass_crypt => "testtest", :pass_crypt_confirmation => "testtest", :auth_provider => "google", - :auth_uid => "123454321", - :consider_pd => "1" } } + :auth_uid => "123454321" } } end end end @@ -97,8 +95,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => email, :display_name => display_name, :pass_crypt => "testtest", - :pass_crypt_confirmation => "blahblah", - :consider_pd => "1" } } + :pass_crypt_confirmation => "blahblah" } } end end end @@ -117,8 +114,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => email, :display_name => dup_display_name, :auth_provider => "google", - :auth_uid => "123454321", - :consider_pd => "1" } } + :auth_uid => "123454321" } } end end end @@ -138,8 +134,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :pass_crypt => "testtest", - :pass_crypt_confirmation => "testtest", - :consider_pd => "1" } } + :pass_crypt_confirmation => "testtest" } } assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name follow_redirect! end @@ -192,8 +187,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :pass_crypt => password, - :pass_crypt_confirmation => password, - :consider_pd => "1" }, + :pass_crypt_confirmation => password }, :referer => referer } assert_response(:redirect) assert_redirected_to :controller => :confirmations, :action => :confirm, :display_name => display_name @@ -254,8 +248,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "openid", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } end end end @@ -330,8 +323,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "openid", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } follow_redirect! end end @@ -392,8 +384,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "google", - :auth_uid => auth_uid, - :consider_pd => "1" }, + :auth_uid => auth_uid }, :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! @@ -479,8 +470,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "google", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } assert_response :redirect follow_redirect! end @@ -541,8 +531,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "facebook", - :auth_uid => auth_uid, - :consider_pd => "1" }, + :auth_uid => auth_uid }, :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! @@ -628,8 +617,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "facebook", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } assert_response :redirect follow_redirect! end @@ -689,8 +677,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :params => { :user => { :email => new_email, :display_name => display_name, :auth_provider => "microsoft", - :auth_uid => auth_uid, - :consider_pd => "1" }, + :auth_uid => auth_uid }, :email_hmac => email_hmac } assert_redirected_to welcome_path follow_redirect! @@ -775,8 +762,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "microsoft", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } assert_response :redirect follow_redirect! end @@ -926,8 +912,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "github", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } assert_response :redirect follow_redirect! end @@ -1076,8 +1061,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest :email_hmac => email_hmac, :display_name => display_name, :auth_provider => "wikipedia", - :auth_uid => auth_uid, - :consider_pd => "1" } } + :auth_uid => auth_uid } } assert_response :redirect follow_redirect! end From 41a1867043fd9441578f8653a375963024a22676 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 18 Jan 2025 07:23:55 +0300 Subject: [PATCH 10/10] Remove pd checkbox from terms page --- app/controllers/accounts/terms_controller.rb | 1 - app/views/accounts/terms/show.html.erb | 9 --------- config/locales/en.yml | 3 --- test/controllers/accounts/terms_controller_test.rb | 6 ++---- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/app/controllers/accounts/terms_controller.rb b/app/controllers/accounts/terms_controller.rb index 45e0cc239..704532988 100644 --- a/app/controllers/accounts/terms_controller.rb +++ b/app/controllers/accounts/terms_controller.rb @@ -34,7 +34,6 @@ module Accounts flash[:notice] = { :partial => "accounts/terms/terms_declined_flash" } if current_user.save else unless current_user.terms_agreed? - current_user.consider_pd = params[:user][:consider_pd] current_user.tou_agreed = Time.now.utc current_user.terms_agreed = Time.now.utc current_user.terms_seen = true diff --git a/app/views/accounts/terms/show.html.erb b/app/views/accounts/terms/show.html.erb index 3cc52302f..c1c0e0a89 100644 --- a/app/views/accounts/terms/show.html.erb +++ b/app/views/accounts/terms/show.html.erb @@ -72,13 +72,4 @@ <%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :disabled => true, :class => "btn btn-primary") %> <%= submit_tag(t(".cancel"), :name => "decline", :id => "decline", :class => "btn btn-outline-secondary") %>
- -
-
- <%= check_box("user", "consider_pd", :class => "form-check-input") %> - - (<%= link_to(t(".consider_pd_why"), t(".consider_pd_why_url"), :target => :new) %>) -
<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c802f2ab8..55b15fc8b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -306,9 +306,6 @@ en: read_ct: "I have read and agree to the above contributor terms" tou_explain_html: "These %{tou_link} govern the use of the website and other infrastructure provided by the OSMF. Please click on the link, read and agree to the text." read_tou: "I have read and agree to the Terms of Use" - consider_pd: "In addition to the above, I consider my contributions to be in the Public Domain" - consider_pd_why: "what's this?" - consider_pd_why_url: https://osmfoundation.org/wiki/Licence_and_Legal_FAQ/Why_would_I_want_my_contributions_to_be_public_domain guidance_info_html: "Information to help understand these terms: a %{readable_summary_link} and some %{informal_translations_link}" readable_summary: human readable summary informal_translations: informal translations diff --git a/test/controllers/accounts/terms_controller_test.rb b/test/controllers/accounts/terms_controller_test.rb index 768884666..55b30506b 100644 --- a/test/controllers/accounts/terms_controller_test.rb +++ b/test/controllers/accounts/terms_controller_test.rb @@ -52,13 +52,12 @@ module Accounts user = create(:user, :terms_seen => false, :terms_agreed => nil) session_for(user) - put account_terms_path, :params => { :user => { :consider_pd => true }, :read_ct => 1, :read_tou => 1 } + put account_terms_path, :params => { :read_ct => 1, :read_tou => 1 } assert_redirected_to edit_account_path assert_equal "Thanks for accepting the new contributor terms!", flash[:notice] user.reload - assert user.consider_pd assert_not_nil user.terms_agreed assert user.terms_seen end @@ -67,13 +66,12 @@ module Accounts user = create(:user, :terms_seen => false, :terms_agreed => nil) session_for(user) - put account_terms_path, :params => { :user => { :consider_pd => true }, :referer => "/test", :read_ct => 1, :read_tou => 1 } + put account_terms_path, :params => { :referer => "/test", :read_ct => 1, :read_tou => 1 } assert_redirected_to "/test" assert_equal "Thanks for accepting the new contributor terms!", flash[:notice] user.reload - assert user.consider_pd assert_not_nil user.terms_agreed assert user.terms_seen end