Ensure CTI Log caller ID entries include user organization names (fixes #2075)
This commit is contained in:
parent
902300e840
commit
a25d094d5f
2 changed files with 79 additions and 2 deletions
|
@ -25,7 +25,7 @@
|
|||
<% for caller_id in item.preferences.from: %>
|
||||
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
|
||||
<% shown = true %>
|
||||
<% user = App.User.find(caller_id.user_id) %>
|
||||
<% user = App.User.fullLocal(caller_id.user_id) %>
|
||||
<% classes = ['user-popover'] %>
|
||||
<% classes.push('is-inactive') if !user.active %>
|
||||
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<% for caller_id in item.preferences.to: %>
|
||||
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
|
||||
<% shown = true %>
|
||||
<% user = App.User.find(caller_id.user_id) %>
|
||||
<% user = App.User.fullLocal(caller_id.user_id) %>
|
||||
<% classes = ['user-popover'] %>
|
||||
<% classes.push('is-inactive') if !user.active %>
|
||||
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
|
||||
|
|
|
@ -210,4 +210,81 @@ class IntegrationCtiTest < TestCase
|
|||
value: 'John Doe',
|
||||
)
|
||||
end
|
||||
|
||||
# Regression test for #2075
|
||||
def test_caller_ids_include_organization_names
|
||||
id = rand(99_999_999)
|
||||
|
||||
@browser = browser_instance
|
||||
login(
|
||||
username: 'master@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
|
||||
# create user with organization (via API)
|
||||
user_create(
|
||||
data: {
|
||||
login: 'test_user',
|
||||
firstname: 'John',
|
||||
lastname: 'Doe',
|
||||
phone: '1234567890',
|
||||
organization: 'Zammad Foundation'
|
||||
},
|
||||
)
|
||||
|
||||
# enable CTI
|
||||
click(css: 'a[href="#manage"]')
|
||||
click(css: 'a[href="#system/integration"]')
|
||||
click(css: 'a[href="#system/integration/cti"]')
|
||||
|
||||
switch(
|
||||
css: '.content.active .js-switch',
|
||||
type: 'on'
|
||||
)
|
||||
|
||||
watch_for(
|
||||
css: 'a[href="#cti"]'
|
||||
)
|
||||
|
||||
# view caller log
|
||||
click(css: 'a[href="#cti"]')
|
||||
|
||||
# simulate CTI callbacks to/from target user
|
||||
url = URI.join(browser_url, "api/v1/cti/#{ENV['CTI_TOKEN']}")
|
||||
params = {
|
||||
direction: 'out',
|
||||
from: '1234567890',
|
||||
to: '1234567890',
|
||||
callId: "4991155921769858278-#{id}",
|
||||
cause: 'busy'
|
||||
}
|
||||
Net::HTTP.post_form(url, params.merge(event: 'newCall'))
|
||||
Net::HTTP.post_form(url, params.merge(event: 'hangup'))
|
||||
|
||||
params = {
|
||||
direction: 'in',
|
||||
from: '1234567890',
|
||||
to: '1234567890',
|
||||
callId: "4991155921769858278-#{id.next}",
|
||||
cause: 'busy'
|
||||
}
|
||||
Net::HTTP.post_form(url, params.merge(event: 'newCall'))
|
||||
Net::HTTP.post_form(url, params.merge(event: 'hangup'))
|
||||
|
||||
watch_for(
|
||||
css: '.js-callerLog tr:nth-of-type(2)'
|
||||
)
|
||||
|
||||
# assertions: Caller ID includes user organization
|
||||
match(
|
||||
css: '.js-callerLog tr:first-of-type span.user-popover',
|
||||
value: 'John Doe (Zammad Foundation)',
|
||||
)
|
||||
|
||||
match(
|
||||
css: '.js-callerLog tr:last-of-type span.user-popover',
|
||||
value: 'John Doe (Zammad Foundation)',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue