Fixed issue #1426 by adding full time format string to Email quotes (fixes #1426)

This commit is contained in:
Billy Zhou 2018-08-22 09:55:39 +02:00
parent 10007e6409
commit 35a2e991a6
2 changed files with 65 additions and 1 deletions

View file

@ -148,7 +148,11 @@ class EmailReply extends App.Controller
selected = App.Utils.text2html(selected)
if selected
selected = "<div><br><br/></div><div><blockquote type=\"cite\">#{selected}</blockquote></div><div><br></div>"
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 = "<div><br><br/></div><div><blockquote type=\'cite\'><br>#{quote_header}<br><br>#{selected}<br></blockquote></div><div><br></div>"
# 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()

View file

@ -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 <nicole\.braun@zammad\.org> wrote:/)
assert match
assert match[1]
assert Time.zone.parse(match[1])
end
end