Follow up for issue #338 behaviour reply behaviour.
This commit is contained in:
parent
cc5a5fb9ae
commit
ee7319ab1f
4 changed files with 26 additions and 7 deletions
|
@ -195,6 +195,7 @@ class EmailReply extends App.Controller
|
|||
type: type
|
||||
article: articleNew
|
||||
signaturePosition: signaturePosition
|
||||
focus: 'to'
|
||||
})
|
||||
|
||||
# add attachments to form
|
||||
|
|
|
@ -54,19 +54,23 @@ class App.TicketZoomArticleNew extends App.Controller
|
|||
@openTextarea(null, true)
|
||||
for key, value of data.article
|
||||
if key is 'body'
|
||||
@$('[data-name="' + key + '"]').html(value)
|
||||
@$("[data-name=\"#{key}\"]").html(value)
|
||||
else
|
||||
@$('[name="' + key + '"]').val(value).trigger('change')
|
||||
@$("[name=\"#{key}\"]").val(value).trigger('change')
|
||||
|
||||
# preselect article type
|
||||
@setArticleType(data.type.name, data.signaturePosition)
|
||||
|
||||
# set focus into field
|
||||
if data.focus
|
||||
@$("[name=\"#{data.focus}\"], [data-name=\"#{data.focus}\"]").focus().parent().find('.token-input').focus()
|
||||
return
|
||||
|
||||
# set focus at end of field
|
||||
if data.position is 'end'
|
||||
@placeCaretAtEnd(@textarea.get(0))
|
||||
return
|
||||
|
||||
# set focus into field
|
||||
@textarea.focus()
|
||||
)
|
||||
|
||||
|
@ -89,7 +93,6 @@ class App.TicketZoomArticleNew extends App.Controller
|
|||
# set expand of text area only once
|
||||
@bind('ui::ticket::shown', (data) =>
|
||||
return if data.ticket_id.toString() isnt @ticket.id.toString()
|
||||
console.log('SHOW, ui::ticket::shown', data.ticket_id)
|
||||
@tokanice()
|
||||
)
|
||||
|
||||
|
@ -111,6 +114,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
|||
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')
|
||||
|
|
|
@ -428,11 +428,15 @@ class UsersController < ApplicationController
|
|||
if params[:label] || params[:term]
|
||||
users = []
|
||||
user_all.each do |user|
|
||||
realname = user.firstname.to_s + ' ' + user.lastname.to_s
|
||||
if user.email && user.email.to_s != ''
|
||||
realname = user.fullname
|
||||
if user.email.present? && realname != user.email
|
||||
realname = "#{realname} <#{user.email}>"
|
||||
end
|
||||
a = { id: user.id, label: realname, value: user.email }
|
||||
a = if params[:term]
|
||||
{ id: user.id, label: realname, value: user.email }
|
||||
else
|
||||
{ id: user.id, label: realname, value: realname }
|
||||
end
|
||||
users.push a
|
||||
end
|
||||
|
||||
|
|
|
@ -527,6 +527,16 @@ class UserControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_not(result[0]['role_ids'])
|
||||
assert_not(result[0]['roles'])
|
||||
|
||||
get "/api/v1/users/search?term=#{CGI.escape("Customer#{firstname}")}", params: {}, headers: @headers.merge('Authorization' => credentials)
|
||||
assert_response(200)
|
||||
result = JSON.parse(@response.body)
|
||||
assert_equal(Array, result.class)
|
||||
assert_equal(result_user1['id'], result[0]['id'])
|
||||
assert_equal("Customer#{firstname} Customer Last <new_customer_by_agent@example.com>", result[0]['label'])
|
||||
assert_equal('new_customer_by_agent@example.com', result[0]['value'])
|
||||
assert_not(result[0]['role_ids'])
|
||||
assert_not(result[0]['roles'])
|
||||
|
||||
role = Role.find_by(name: 'Agent')
|
||||
get "/api/v1/users/search?query=#{CGI.escape("Customer#{firstname}")}&role_ids=#{role.id}&label=true", params: {}, headers: @headers.merge('Authorization' => credentials)
|
||||
assert_response(200)
|
||||
|
|
Loading…
Reference in a new issue