Fixes #1990 missing CC autocomplete
This commit is contained in:
parent
6e899948c1
commit
662032aa13
5 changed files with 68 additions and 16 deletions
|
@ -33,6 +33,7 @@ class App.TicketCreate extends App.Controller
|
||||||
@bind('ui:rerender', =>
|
@bind('ui:rerender', =>
|
||||||
return if !@authenticateCheck()
|
return if !@authenticateCheck()
|
||||||
@renderQueue()
|
@renderQueue()
|
||||||
|
@tokanice()
|
||||||
)
|
)
|
||||||
|
|
||||||
# listen to rerender sidebars
|
# listen to rerender sidebars
|
||||||
|
@ -55,6 +56,7 @@ class App.TicketCreate extends App.Controller
|
||||||
changeFormType: (e) =>
|
changeFormType: (e) =>
|
||||||
type = $(e.currentTarget).data('type')
|
type = $(e.currentTarget).data('type')
|
||||||
@setFormTypeInUi(type)
|
@setFormTypeInUi(type)
|
||||||
|
@tokanice()
|
||||||
|
|
||||||
setFormTypeInUi: (type) =>
|
setFormTypeInUi: (type) =>
|
||||||
|
|
||||||
|
@ -347,6 +349,11 @@ class App.TicketCreate extends App.Controller
|
||||||
# update taskbar with new meta data
|
# update taskbar with new meta data
|
||||||
App.TaskManager.touch(@taskKey)
|
App.TaskManager.touch(@taskKey)
|
||||||
|
|
||||||
|
@tokanice()
|
||||||
|
|
||||||
|
tokanice: ->
|
||||||
|
App.Utils.tokaniceEmails('.content.active input[name=cc]')
|
||||||
|
|
||||||
localUserInfo: (e) =>
|
localUserInfo: (e) =>
|
||||||
return if !@sidebarWidget
|
return if !@sidebarWidget
|
||||||
params = App.ControllerForm.params($(e.target).closest('form'))
|
params = App.ControllerForm.params($(e.target).closest('form'))
|
||||||
|
|
|
@ -103,22 +103,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
tokanice: ->
|
tokanice: ->
|
||||||
source = "#{App.Config.get('api_path')}/users/search"
|
App.Utils.tokaniceEmails('.content.active .js-to, .js-cc, js-bcc')
|
||||||
a = ->
|
|
||||||
$('.content.active .js-to, .js-cc, js-bcc').tokenfield(
|
|
||||||
createTokensOnBlur: true
|
|
||||||
autocomplete: {
|
|
||||||
source: source
|
|
||||||
minLength: 2
|
|
||||||
},
|
|
||||||
).on('tokenfield:createtoken', (e) ->
|
|
||||||
if !e.attrs.value.match(/@/) || e.attrs.value.match(/\s/)
|
|
||||||
e.preventDefault()
|
|
||||||
return false
|
|
||||||
e.attrs.label = e.attrs.value
|
|
||||||
true
|
|
||||||
)
|
|
||||||
App.Delay.set(a, 500, undefined, 'tags')
|
|
||||||
|
|
||||||
setPossibleArticleTypes: =>
|
setPossibleArticleTypes: =>
|
||||||
@articleTypes = []
|
@articleTypes = []
|
||||||
|
|
|
@ -1060,3 +1060,23 @@ class App.Utils
|
||||||
articleNew.cc = addAddresses(article.cc, articleNew.cc)
|
articleNew.cc = addAddresses(article.cc, articleNew.cc)
|
||||||
|
|
||||||
articleNew
|
articleNew
|
||||||
|
|
||||||
|
# apply email token field with autocompletion
|
||||||
|
@tokaniceEmails: (selector) ->
|
||||||
|
source = "#{App.Config.get('api_path')}/users/search"
|
||||||
|
a = ->
|
||||||
|
$(selector).tokenfield(
|
||||||
|
createTokensOnBlur: true
|
||||||
|
autocomplete: {
|
||||||
|
source: source
|
||||||
|
minLength: 2
|
||||||
|
},
|
||||||
|
).on('tokenfield:createtoken', (e) ->
|
||||||
|
if !e.attrs.value.match(/@/) || e.attrs.value.match(/\s/)
|
||||||
|
e.preventDefault()
|
||||||
|
return false
|
||||||
|
e.attrs.label = e.attrs.value
|
||||||
|
true
|
||||||
|
)
|
||||||
|
App.Delay.set(a, 500, undefined, 'tags')
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ if [ "$LEVEL" == '1' ]; then
|
||||||
# test/browser/agent_organization_profile_test.rb
|
# test/browser/agent_organization_profile_test.rb
|
||||||
rm test/browser/agent_ticket_attachment_test.rb
|
rm test/browser/agent_ticket_attachment_test.rb
|
||||||
rm test/browser/agent_ticket_auto_assignment_test.rb
|
rm test/browser/agent_ticket_auto_assignment_test.rb
|
||||||
|
rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||||
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||||
rm test/browser/agent_ticket_create_template_test.rb
|
rm test/browser/agent_ticket_create_template_test.rb
|
||||||
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||||
|
@ -89,6 +90,7 @@ elif [ "$LEVEL" == '2' ]; then
|
||||||
rm test/browser/agent_organization_profile_test.rb
|
rm test/browser/agent_organization_profile_test.rb
|
||||||
rm test/browser/agent_ticket_attachment_test.rb
|
rm test/browser/agent_ticket_attachment_test.rb
|
||||||
rm test/browser/agent_ticket_auto_assignment_test.rb
|
rm test/browser/agent_ticket_auto_assignment_test.rb
|
||||||
|
rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||||
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||||
rm test/browser/agent_ticket_create_template_test.rb
|
rm test/browser/agent_ticket_create_template_test.rb
|
||||||
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||||
|
@ -155,6 +157,7 @@ elif [ "$LEVEL" == '3' ]; then
|
||||||
rm test/browser/agent_organization_profile_test.rb
|
rm test/browser/agent_organization_profile_test.rb
|
||||||
# test/browser/agent_ticket_attachment_test.rb
|
# test/browser/agent_ticket_attachment_test.rb
|
||||||
# test/browser/agent_ticket_auto_assignment_test.rb
|
# test/browser/agent_ticket_auto_assignment_test.rb
|
||||||
|
#rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||||
# test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
# test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||||
# test/browser/agent_ticket_create_template_test.rb
|
# test/browser/agent_ticket_create_template_test.rb
|
||||||
# test/browser/agent_ticket_email_reply_keep_body_test.rb
|
# test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||||
|
@ -221,6 +224,7 @@ elif [ "$LEVEL" == '4' ]; then
|
||||||
rm test/browser/agent_organization_profile_test.rb
|
rm test/browser/agent_organization_profile_test.rb
|
||||||
rm test/browser/agent_ticket_attachment_test.rb
|
rm test/browser/agent_ticket_attachment_test.rb
|
||||||
rm test/browser/agent_ticket_auto_assignment_test.rb
|
rm test/browser/agent_ticket_auto_assignment_test.rb
|
||||||
|
rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||||
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||||
rm test/browser/agent_ticket_create_template_test.rb
|
rm test/browser/agent_ticket_create_template_test.rb
|
||||||
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||||
|
@ -286,6 +290,7 @@ elif [ "$LEVEL" == '5' ]; then
|
||||||
rm test/browser/agent_organization_profile_test.rb
|
rm test/browser/agent_organization_profile_test.rb
|
||||||
rm test/browser/agent_ticket_attachment_test.rb
|
rm test/browser/agent_ticket_attachment_test.rb
|
||||||
rm test/browser/agent_ticket_auto_assignment_test.rb
|
rm test/browser/agent_ticket_auto_assignment_test.rb
|
||||||
|
rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||||
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||||
rm test/browser/agent_ticket_create_template_test.rb
|
rm test/browser/agent_ticket_create_template_test.rb
|
||||||
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||||
|
@ -354,6 +359,7 @@ elif [ "$LEVEL" == '6' ]; then
|
||||||
rm test/browser/agent_organization_profile_test.rb
|
rm test/browser/agent_organization_profile_test.rb
|
||||||
rm test/browser/agent_ticket_attachment_test.rb
|
rm test/browser/agent_ticket_attachment_test.rb
|
||||||
rm test/browser/agent_ticket_auto_assignment_test.rb
|
rm test/browser/agent_ticket_auto_assignment_test.rb
|
||||||
|
rm test/browser/agent_ticket_create_cc_tokenizer_test.rb
|
||||||
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
rm test/browser/agent_ticket_create_reset_customer_selection_test.rb
|
||||||
rm test/browser/agent_ticket_create_template_test.rb
|
rm test/browser/agent_ticket_create_template_test.rb
|
||||||
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
rm test/browser/agent_ticket_email_reply_keep_body_test.rb
|
||||||
|
|
34
test/browser/agent_ticket_create_cc_tokenizer_test.rb
Normal file
34
test/browser/agent_ticket_create_cc_tokenizer_test.rb
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
require 'browser_test_helper'
|
||||||
|
|
||||||
|
# Regression test for UI bugfix
|
||||||
|
# https://github.com/zammad/zammad/issues/1990
|
||||||
|
#
|
||||||
|
# Ensure that CC field when creating a new ticket is autocompleting user emails
|
||||||
|
|
||||||
|
class AgentTicketCreateResetCustomerSelectionTest < TestCase
|
||||||
|
def test_tokenizer
|
||||||
|
@browser = browser_instance
|
||||||
|
|
||||||
|
login(
|
||||||
|
username: 'agent1@example.com',
|
||||||
|
password: 'test',
|
||||||
|
url: browser_url,
|
||||||
|
)
|
||||||
|
tasks_close_all()
|
||||||
|
|
||||||
|
click(
|
||||||
|
css: 'a[href="#ticket/create"]'
|
||||||
|
)
|
||||||
|
|
||||||
|
@browser.find_element(:css, 'li[data-type=email-out]').click
|
||||||
|
|
||||||
|
elem = @browser.find_element(:name, 'cc')
|
||||||
|
elem.send_keys 'test@example.com'
|
||||||
|
elem.send_keys :enter
|
||||||
|
|
||||||
|
exists(
|
||||||
|
css: '.token-label',
|
||||||
|
value: 'test@example.com'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue