From 35a2e991a636102eaa9824eade048de9f77a71eb Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Wed, 22 Aug 2018 09:55:39 +0200 Subject: [PATCH] Fixed issue #1426 by adding full time format string to Email quotes (fixes #1426) --- .../article_action/email_reply.coffee | 15 +++++- ...agent_ticket_email_reply_keep_body_test.rb | 51 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee index ca2df890c..658fd6ab0 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee @@ -148,7 +148,11 @@ class EmailReply extends App.Controller selected = App.Utils.text2html(selected) if selected - selected = "


#{selected}

" + date = @date_format(article.updated_by.created_at) + name = article.updated_by.displayName() + email = article.updated_by.email + quote_header = App.i18n.translateInline('On %s, %s <%s> wrote:', date, name, email) + selected = "



#{quote_header}

#{selected}

" # add selected text to body body = selected + body @@ -168,6 +172,15 @@ class EmailReply extends App.Controller true + @date_format: (date_string) -> + options = { + weekday: 'long' + month: 'long' + day: 'numeric' + year: 'numeric' + } + new Date(date_string).toLocaleTimeString('en-US', options) + @emailForward: (ticket, article, ui) -> ui.scrollToCompose() diff --git a/test/browser/agent_ticket_email_reply_keep_body_test.rb b/test/browser/agent_ticket_email_reply_keep_body_test.rb index 3878d2e85..f5fe70707 100644 --- a/test/browser/agent_ticket_email_reply_keep_body_test.rb +++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb @@ -79,4 +79,55 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase ) end + + def test_full_quote + @browser = instance = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + ticket_open_by_title( + title: 'Welcome to Zammad', + ) + watch_for( + css: '.content.active .js-settingContainer .js-setting .dropdown-icon', + ) + + # enable email full quote in the ticket zoom config page + scroll_to( + position: 'botton', + css: '.content.active .js-settingContainer .js-setting .dropdown-icon', + ) + click(css: '.content.active .js-settingContainer .js-setting .dropdown-icon') + modal_ready() + select( + css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]', + value: 'yes' + ) + click( + css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]', + ) + modal_close() + modal_disappear() + + exists(css: '.content.active .ticket-article [data-type="emailReply"]') + + # scroll to reply - needed for chrome + scroll_to( + position: 'botton', + css: '.content.active .ticket-article [data-type="emailReply"]', + ) + + click(css: '.content.active .ticket-article [data-type="emailReply"]') + + full_text = @browser.find_element(css: '.content.active .article-new .articleNewEdit-body').text + + match = full_text.match(/\nOn (.*?) Nicole Braun wrote:/) + assert match + assert match[1] + assert Time.zone.parse(match[1]) + end end