Browse Source

Fixed #2332 - Role-Filter shows inactive Roles

Billy Zhou 6 years ago
parent
commit
5796f78c4f

+ 1 - 1
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(

+ 30 - 0
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

+ 4 - 0
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