Fixes #3919 - UI is not updated right after importing users csv file.

This commit is contained in:
Rolf Schmidt 2022-03-18 12:42:19 +01:00
parent dcfe8759ff
commit 56ae3eb8e8
2 changed files with 36 additions and 4 deletions

View file

@ -182,6 +182,9 @@ class User extends App.ControllerSubContent
'click': edit
)
if !@subscribeId
@subscribeId = App.User.subscribe(=> @delay(@search, 220, 'search'))
search: =>
role_ids = []
@$('.tab.active').each( (i,d) ->
@ -239,4 +242,8 @@ class User extends App.ControllerSubContent
container: @el.closest('.content')
)
release: =>
if @subscribeId
App.User.unsubscribe(@subscribeId)
App.Config.set( 'User', { prio: 1000, name: __('Users'), parent: '#manage', target: '#manage/users', controller: User, permission: ['admin.user'] }, 'NavBarAdmin' )

View file

@ -3,14 +3,15 @@
require 'rails_helper'
RSpec.describe 'Manage > Users', type: :system do
describe 'switching to an alternative user', authentication_type: :form, authenticated_as: -> { original_user } do
describe 'switching to an alternative user', authentication_type: :form, authenticated_as: :authenticate do
let(:original_user) { create(:admin) }
let(:alternative_one_user) { create(:admin) }
let(:alternative_two_user) { create(:admin) }
before do
def authenticate
alternative_one_user
alternative_two_user
original_user
end
it 'starts as original user' do
@ -91,9 +92,14 @@ RSpec.describe 'Manage > Users', type: :system do
end
end
describe 'show/unlock a user', authenticated_as: -> { user } do
describe 'show/unlock a user', authenticated_as: :authenticate do
let(:user) { create(:admin) }
let!(:locked_user) { create(:user, login_failed: 6) }
let(:locked_user) { create(:user, login_failed: 6) }
def authenticate
locked_user
user
end
it 'check marked locked user and execute unlock action' do
visit '#manage/users'
@ -242,4 +248,23 @@ RSpec.describe 'Manage > Users', type: :system do
end
end
describe 'UI is not updated right after importing users csv file #3919' do
before do
visit '#manage/users'
ensure_websocket
User.csv_import(
string: File.read(Rails.root.join('spec/fixtures/csv_import/user/simple.csv')),
parse_params: {
col_sep: ';',
},
try: false,
delete: false,
)
end
it 'does update the user list after import of new users' do
expect(page).to have_text('firstname-simple-import1')
end
end
end