From: Andy Allan Date: Wed, 5 Jan 2022 18:14:30 +0000 (+0000) Subject: Fix display of suspension message when a user is suspended mid-session X-Git-Tag: live~1854^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/4bed9c12a0b5e8302098f1646802ce247abf95ee Fix display of suspension message when a user is suspended mid-session Without the ability defined, the user is still logged out, but then the deny_access check redirects to the login page. The re-login attempt would then fail anyway, with an error message, but let's fix the abilities and use the intended page. --- diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index a45bf9a57..b8e21b486 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -23,7 +23,7 @@ class Ability can [:index, :show], Redaction can [:new, :create, :destroy], :session can [:index, :show, :data, :georss, :picture, :icon], Trace - can [:terms, :new, :create, :save, :show, :auth_success, :auth_failure], User + can [:terms, :new, :create, :save, :suspended, :show, :auth_success, :auth_failure], User can [:index, :show, :blocks_on, :blocks_by], UserBlock can [:index, :show], Node can [:index, :show, :full, :ways_for_node], Way diff --git a/test/system/user_suspension_test.rb b/test/system/user_suspension_test.rb new file mode 100644 index 000000000..075303ff0 --- /dev/null +++ b/test/system/user_suspension_test.rb @@ -0,0 +1,15 @@ +require "application_system_test_case" + +class UserSuspensionTest < ApplicationSystemTestCase + test "User shown a message when suspended mid-session" do + user = create(:user) + sign_in_as(user) + visit edit_account_path + assert_content "My Settings" + + user.update(:status => "suspended") + + visit edit_account_path + assert_content "This decision will be reviewed by an administrator shortly" + end +end