diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee index 5b7461f16..0ef3174d8 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee @@ -190,7 +190,7 @@ class App.TicketZoomArticleActions extends App.Controller articleNew.cc = addAddresses(articleNew.cc, article.cc) # get current body - body = @el.closest('[data-name="body"]').html() || '' + body = @el.closest('.ticketZoom').find('.article-add [data-name="body"]').html() || '' # check if quote need to be added selectedText = App.ClipBoard.getSelected() diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee index 9ec00bdac..73ef9913f 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee @@ -95,28 +95,28 @@ class App.TicketZoomArticleNew extends App.Controller @bind( 'ui::ticket::setArticleType' (data) => - if data.ticket.id is @ticket.id - #@setArticleType(data.type.name) + return if data.ticket.id isnt @ticket.id + #@setArticleType(data.type.name) - @openTextarea(null, true) - for key, value of data.article - if key is 'body' - @$('[data-name="' + key + '"]').html(value) - else - @$('[name="' + key + '"]').val(value) + @openTextarea(null, true) + for key, value of data.article + if key is 'body' + @$('[data-name="' + key + '"]').html(value) + else + @$('[name="' + key + '"]').val(value) - # preselect article type - @setArticleType( 'email' ) + # preselect article type + @setArticleType('email') ) # reset new article screen @bind( 'ui::ticket::taskReset' (data) => - if data.ticket_id is @ticket.id - @type = 'note' - @defaults = {} - @render() + return if data.ticket_id isnt @ticket.id + @type = 'note' + @defaults = {} + @render() ) isIE10: -> diff --git a/test/browser/agent_ticket_actions_level7_test.rb b/test/browser/agent_ticket_actions_level7_test.rb new file mode 100644 index 000000000..a143397dd --- /dev/null +++ b/test/browser/agent_ticket_actions_level7_test.rb @@ -0,0 +1,63 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class AgentTicketActionLevel7Test < TestCase + def test_reply_message_keep_body + + # merge ticket with closed tab + @browser = browser_instance + login( + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + # create new ticket + ticket1 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: 'some subject 123äöü - reply test', + body: 'some body 123äöü - reply test', + }, + ) + sleep 1 + + # fill body + ticket_update( + data: { + body: 'keep me', + }, + do_not_submit: true, + ) + + # click reply + click( css: '.content.active [data-type="reply"]' ) + + # check body + watch_for( + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, + ) + + # check body + ticket_verify( + data: { + body: 'keep me', + }, + ) + + # click reply + click( css: '.content.active [data-type="reply"]' ) + + # check body + watch_for( + css: '.content.active .js-reset', + value: '(Discard your unsaved changes.|Verwerfen der)', + no_quote: true, + ) + + end +end