Fixes #2011 user with granular permissions is shown only once in overlay

This commit is contained in:
Mantas 2018-05-15 16:20:59 +03:00
parent 498980b52c
commit 264ab24aed
2 changed files with 25 additions and 9 deletions

View file

@ -415,7 +415,7 @@ class App.TicketOverview extends App.Controller
group = App.Group.find(groupId)
users = []
for user_id in group.user_ids
for user_id in _.uniq(group.user_ids)
if App.User.exists(user_id)
user = App.User.find(user_id)
if user.active is true
@ -620,7 +620,7 @@ class App.TicketOverview extends App.Controller
users.push user
for group in groups
valid_user_ids = []
for user_id in group.user_ids
for user_id in _.uniq(group.user_ids)
if App.User.exists(user_id)
if App.User.find(user_id).active is true
valid_user_ids.push user_id

View file

@ -43,13 +43,7 @@ class AdminDragDropToNewGroupTest < TestCase
assert_not_nil(group)
checkbox = group.find_element(css: 'input[value=full]')
@browser
.action
.move_to(checkbox, 0, 10)
.click
.perform
%w[read create].each { |val| toggle_checkbox(group, val) }
click(css: '.modal button.js-submit')
@ -85,5 +79,27 @@ class AdminDragDropToNewGroupTest < TestCase
group_description = new_group_container.find_element(css: '.batch-overlay-assign-entry-detail').text
assert_equal('1 PEOPLE', group_description)
@browser
.action
.move_to(new_group_container)
.perform
sleep(1)
users_in_group = @browser.find_elements(css: '.js-batch-assign-group-inner .batch-overlay-assign-entry[data-action=user_assign]')
assert_equal(1, users_in_group.count)
end
private
def toggle_checkbox(scope, value)
checkbox = scope.find_element(css: "input[value=#{value}]")
@browser
.action
.move_to(checkbox, 0, 10)
.click
.perform
end
end