-
- <%= 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/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 5571a4232..eaf0fdf15 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -260,6 +260,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:
@@ -305,9 +307,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
@@ -325,6 +324,17 @@ 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
+ 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
+ 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}"
@@ -2785,9 +2795,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/config/routes.rb b/config/routes.rb
index 45fc19f2c..3971494aa 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -298,6 +298,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, :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
new file mode 100644
index 000000000..be0d46f1e
--- /dev/null
+++ b/test/controllers/accounts/pd_declarations_controller_test.rb
@@ -0,0 +1,92 @@
+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" }
+ )
+ assert_routing(
+ { :path => "/account/pd_declaration", :method => :post },
+ { :controller => "accounts/pd_declarations", :action => "create" }
+ )
+ 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
+
+ def test_create_not_logged_in
+ post account_pd_declaration_path
+
+ assert_response :forbidden
+ end
+
+ 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/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
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
diff --git a/test/system/account_pd_declaration_test.rb b/test/system/account_pd_declaration_test.rb
new file mode 100644
index 000000000..d58484c8c
--- /dev/null
+++ b/test/system/account_pd_declaration_test.rb
@@ -0,0 +1,46 @@
+require "application_system_test_case"
+
+class AccountPdDeclarationTest < ApplicationSystemTestCase
+ def setup
+ @user = create(:user, :display_name => "test user")
+ sign_in_as(@user)
+ end
+
+ 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
+
+ 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
+ assert_button "Confirm", :disabled => true
+ end
+ end
+end