diff --git a/app/assets/javascripts/app/controllers/users.coffee b/app/assets/javascripts/app/controllers/users.coffee index 2aca442d0..2b78316fc 100644 --- a/app/assets/javascripts/app/controllers/users.coffee +++ b/app/assets/javascripts/app/controllers/users.coffee @@ -18,7 +18,7 @@ class Index extends App.ControllerSubContent { name: 'Import', 'data-type': 'import', class: 'btn' } { name: 'New User', 'data-type': 'new', class: 'btn--success' } ] - roles: App.Role.all() + roles: App.Role.findAllByAttribute('active', true) ) @$('.tab').on( diff --git a/test/browser/admin_role_test.rb b/test/browser/admin_role_test.rb index 8981373f6..d670085cc 100644 --- a/test/browser/admin_role_test.rb +++ b/test/browser/admin_role_test.rb @@ -226,4 +226,34 @@ class AdminRoleTest < TestCase exists_not(css: '[href="#manage"]') end + + # regression test for issue #2332 - Role-Filter shows inactive Roles + def test_inactive_roles_do_not_show_in_role_filter + name = "some role #{rand(99_999_999)}" + + @browser = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + role_create( + data: { + name: name, + active: false + } + ) + + click( + css: '.content.active a[href="#manage/users"]', + ) + + # an inactive role should not appear in the role filter tabs + match_not( + css: '.content.active .userSearch', + value: name, + ) + end end diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index be8b09415..2003fca28 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -3712,6 +3712,10 @@ wait untill text in selector disabppears end end + if data[:active] == false + select(css: 'select[name="active"]', value: 'inactive') + end + instance.find_elements(css: '.modal button.js-submit')[0].click modal_disappear(browser: instance) 11.times do