Fixed #2332 - Role-Filter shows inactive Roles

This commit is contained in:
Billy Zhou 2018-11-09 21:06:21 +08:00
parent 5bfe56b476
commit 5796f78c4f
3 changed files with 35 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class Index extends App.ControllerSubContent
{ name: 'Import', 'data-type': 'import', class: 'btn' } { name: 'Import', 'data-type': 'import', class: 'btn' }
{ name: 'New User', 'data-type': 'new', class: 'btn--success' } { name: 'New User', 'data-type': 'new', class: 'btn--success' }
] ]
roles: App.Role.all() roles: App.Role.findAllByAttribute('active', true)
) )
@$('.tab').on( @$('.tab').on(

View file

@ -226,4 +226,34 @@ class AdminRoleTest < TestCase
exists_not(css: '[href="#manage"]') exists_not(css: '[href="#manage"]')
end 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 end

View file

@ -3712,6 +3712,10 @@ wait untill text in selector disabppears
end end
end end
if data[:active] == false
select(css: 'select[name="active"]', value: 'inactive')
end
instance.find_elements(css: '.modal button.js-submit')[0].click instance.find_elements(css: '.modal button.js-submit')[0].click
modal_disappear(browser: instance) modal_disappear(browser: instance)
11.times do 11.times do