Skip to content

Commit

Permalink
Ensure CTI Log caller ID entries include user organization names (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Lue committed Aug 27, 2018
1 parent 902300e commit a25d094
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/app/views/cti/caller_log.jst.eco
Expand Up @@ -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 %>
Expand Down Expand Up @@ -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 %>
Expand Down
77 changes: 77 additions & 0 deletions test/browser/integration_cti_test.rb
Expand Up @@ -210,4 +210,81 @@ def test_inactive_users_displayed_with_strikethrough_in_caller_log
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

0 comments on commit a25d094

Please sign in to comment.