From: Tom Hughes Date: Wed, 28 Jul 2021 19:18:07 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/3279' X-Git-Tag: live~2060 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/08e2a06e41eabddf029f5396d516bf683f749448?hp=af637e0d92c200fcd18a370d1e460a05e9ee1a4a Merge remote-tracking branch 'upstream/pull/3279' --- diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ec30eb4e7..727d8ee3f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -30,7 +30,7 @@ class UsersController < ApplicationController # Already agreed to terms, so just show settings redirect_to :action => :account, :display_name => current_user.display_name elsif current_user.nil? && session[:new_user].nil? - redirect_to :action => :login, :referer => request.fullpath + redirect_to login_path(:referer => request.fullpath) end end end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index a73e48211..10c5c3bee 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -414,6 +414,12 @@ class UsersControllerTest < ActionDispatch::IntegrationTest assert_redirected_to :action => :terms, :referer => "/user/#{ERB::Util.u(user.display_name)}/account" end + def test_terms_not_logged_in + get user_terms_path + + assert_redirected_to login_path(:referer => "/user/terms") + end + def test_go_public user = create(:user, :data_public => false) session_for(user)