diff --git a/app/assets/javascripts/app/views/cti/caller_log.jst.eco b/app/assets/javascripts/app/views/cti/caller_log.jst.eco index ddd2d8128..7a962111c 100644 --- a/app/assets/javascripts/app/views/cti/caller_log.jst.eco +++ b/app/assets/javascripts/app/views/cti/caller_log.jst.eco @@ -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 %> diff --git a/test/browser/integration_cti_test.rb b/test/browser/integration_cti_test.rb index ed872a7ad..f12c33199 100644 --- a/test/browser/integration_cti_test.rb +++ b/test/browser/integration_cti_test.rb @@ -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