Fixes #3007 - Customer invitation doesn't work if "customer" role is name wise missing.
This commit is contained in:
parent
f09b82b427
commit
a2e3d8c7b4
3 changed files with 27 additions and 6 deletions
|
@ -48,7 +48,7 @@ class App.DashboardFirstSteps extends App.Controller
|
||||||
#container: @el.closest('.content')
|
#container: @el.closest('.content')
|
||||||
head: 'Invite Customer'
|
head: 'Invite Customer'
|
||||||
screen: 'invite_customer'
|
screen: 'invite_customer'
|
||||||
role: 'Customer'
|
signup: true
|
||||||
)
|
)
|
||||||
|
|
||||||
testTicketLoading: =>
|
testTicketLoading: =>
|
||||||
|
|
|
@ -48,11 +48,13 @@ class App.InviteUser extends App.WizardModal
|
||||||
# set invite flag
|
# set invite flag
|
||||||
@params.invite = true
|
@params.invite = true
|
||||||
|
|
||||||
# find agent role
|
# find signup roles
|
||||||
if @role
|
if @signup
|
||||||
role = App.Role.findByAttribute('name', @role)
|
@params.role_ids = App.Role.search(
|
||||||
if role
|
filter:
|
||||||
@params.role_ids = role.id
|
active: true
|
||||||
|
default_at_signup: true
|
||||||
|
).map((role) -> role.id)
|
||||||
|
|
||||||
user = new App.User
|
user = new App.User
|
||||||
user.load(@params)
|
user.load(@params)
|
||||||
|
|
|
@ -13,4 +13,23 @@ RSpec.describe 'Dashboard', type: :system, authenticated_as: true do
|
||||||
expect(page).to have_css('.ticket_in_process > div > div.stat-title', text: /Your tickets in process/i)
|
expect(page).to have_css('.ticket_in_process > div > div.stat-title', text: /Your tickets in process/i)
|
||||||
expect(page).to have_css('.ticket_reopen > div > div.stat-title', text: /Reopening rate/i)
|
expect(page).to have_css('.ticket_reopen > div > div.stat-title', text: /Reopening rate/i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when customer role is named different', authenticated_as: :authenticate do
|
||||||
|
def authenticate
|
||||||
|
Role.find_by(name: 'Customer').update(name: 'Public')
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'invites a customer user' do
|
||||||
|
visit 'dashboard'
|
||||||
|
find('div.tab[data-area=first-steps-widgets]').click
|
||||||
|
find('.js-inviteCustomer').click
|
||||||
|
fill_in 'Firstname', with: 'Nick'
|
||||||
|
fill_in 'Lastname', with: 'Braun'
|
||||||
|
fill_in 'Email', with: 'nick.braun@zammad.org'
|
||||||
|
click_on 'Invite'
|
||||||
|
await_empty_ajax_queue
|
||||||
|
expect(User.find_by(firstname: 'Nick').roles).to eq([Role.find_by(name: 'Public')])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue