Fixed #2382 - Added Option to switch the Full-Quote-Header on and off
This commit is contained in:
parent
2077fac218
commit
0c97a66d6a
4 changed files with 130 additions and 36 deletions
|
@ -149,11 +149,14 @@ class EmailReply extends App.Controller
|
||||||
selected = App.Utils.text2html(selected)
|
selected = App.Utils.text2html(selected)
|
||||||
|
|
||||||
if selected
|
if selected
|
||||||
|
quote_header = ''
|
||||||
|
if App.Config.get('ui_ticket_zoom_article_email_full_quote_header')
|
||||||
date = @date_format(article.created_at)
|
date = @date_format(article.created_at)
|
||||||
name = article.updated_by.displayName()
|
name = article.updated_by.displayName()
|
||||||
email = article.updated_by.email
|
email = article.updated_by.email
|
||||||
quote_header = App.i18n.translateInline('On %s, %s wrote:', date, name)
|
quote_header = App.i18n.translateInline('On %s, %s wrote:', date, name) + '<br><br>'
|
||||||
selected = "<div><br><br/></div><div><blockquote type=\'cite\'>#{quote_header}<br><br>#{selected}<br></blockquote></div><div><br></div>"
|
|
||||||
|
selected = "<div><br><br/></div><div><blockquote type=\'cite\'>#{quote_header}#{selected}<br></blockquote></div><div><br></div>"
|
||||||
|
|
||||||
# add selected text to body
|
# add selected text to body
|
||||||
body = selected + body
|
body = selected + body
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
class SettingAddEmailFullQuoteHeader < ActiveRecord::Migration[5.1]
|
||||||
|
def up
|
||||||
|
# return if it's a new setup
|
||||||
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
|
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Email - quote header',
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote_header',
|
||||||
|
area: 'UI::TicketZoom',
|
||||||
|
description: 'Enable if you want a timestamped reply header to be automatically inserted in front of quoted messages.',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
display: '',
|
||||||
|
null: true,
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote_header',
|
||||||
|
tag: 'boolean',
|
||||||
|
translate: true,
|
||||||
|
options: {
|
||||||
|
true => 'yes',
|
||||||
|
false => 'no',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
state: true,
|
||||||
|
preferences: {
|
||||||
|
prio: 240,
|
||||||
|
permission: ['admin.ui'],
|
||||||
|
},
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -699,6 +699,33 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
frontend: true
|
frontend: true
|
||||||
)
|
)
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Email - quote header',
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote_header',
|
||||||
|
area: 'UI::TicketZoom',
|
||||||
|
description: 'Enable if you want a timestamped reply header to be automatically inserted in front of quoted messages.',
|
||||||
|
options: {
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
display: '',
|
||||||
|
null: true,
|
||||||
|
name: 'ui_ticket_zoom_article_email_full_quote_header',
|
||||||
|
tag: 'boolean',
|
||||||
|
translate: true,
|
||||||
|
options: {
|
||||||
|
true => 'yes',
|
||||||
|
false => 'no',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
state: true,
|
||||||
|
preferences: {
|
||||||
|
prio: 240,
|
||||||
|
permission: ['admin.ui'],
|
||||||
|
},
|
||||||
|
frontend: true
|
||||||
|
)
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
title: 'Twitter - tweet initials',
|
title: 'Twitter - tweet initials',
|
||||||
name: 'ui_ticket_zoom_article_twitter_initials',
|
name: 'ui_ticket_zoom_article_twitter_initials',
|
||||||
|
|
|
@ -79,6 +79,24 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def change_quote_config(params = {})
|
||||||
|
scroll_to(
|
||||||
|
position: 'botton',
|
||||||
|
css: '.content.active .js-settingContainer .js-setting',
|
||||||
|
)
|
||||||
|
click(css: '.content.active .js-settingContainer .js-setting')
|
||||||
|
modal_ready()
|
||||||
|
select(
|
||||||
|
css: params[:css],
|
||||||
|
value: params[:value]
|
||||||
|
)
|
||||||
|
click(
|
||||||
|
css: params[:submit_css],
|
||||||
|
)
|
||||||
|
modal_close()
|
||||||
|
modal_disappear()
|
||||||
|
end
|
||||||
|
|
||||||
def test_full_quote
|
def test_full_quote
|
||||||
@browser = instance = browser_instance
|
@browser = instance = browser_instance
|
||||||
login(
|
login(
|
||||||
|
@ -96,30 +114,21 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# enable email full quote in the ticket zoom config page
|
# enable email full quote in the ticket zoom config page
|
||||||
scroll_to(
|
change_quote_config(
|
||||||
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"]',
|
css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]',
|
||||||
value: 'yes'
|
value: 'yes',
|
||||||
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]',
|
||||||
)
|
)
|
||||||
click(
|
change_quote_config(
|
||||||
css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]',
|
css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]',
|
||||||
|
value: 'yes',
|
||||||
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]',
|
||||||
)
|
)
|
||||||
modal_close()
|
|
||||||
modal_disappear()
|
|
||||||
|
|
||||||
exists(css: '.content.active .ticket-article [data-type="emailReply"]')
|
|
||||||
|
|
||||||
# scroll to reply - needed for chrome
|
|
||||||
scroll_to(
|
scroll_to(
|
||||||
position: 'botton',
|
position: 'botton',
|
||||||
css: '.content.active .ticket-article [data-type="emailReply"]',
|
css: '.content.active .ticket-article [data-type="emailReply"]',
|
||||||
)
|
)
|
||||||
|
|
||||||
click(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
|
full_text = @browser.find_element(css: '.content.active .article-new .articleNewEdit-body').text
|
||||||
|
@ -128,6 +137,39 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
|
||||||
assert match
|
assert match
|
||||||
assert match[1]
|
assert match[1]
|
||||||
assert Time.zone.parse(match[1])
|
assert Time.zone.parse(match[1])
|
||||||
|
|
||||||
|
# try again, but with the full quote header disabled
|
||||||
|
tasks_close_all()
|
||||||
|
ticket_open_by_title(
|
||||||
|
title: 'Welcome to Zammad',
|
||||||
|
)
|
||||||
|
change_quote_config(
|
||||||
|
css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]',
|
||||||
|
value: 'no',
|
||||||
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]',
|
||||||
|
)
|
||||||
|
|
||||||
|
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_nil match
|
||||||
|
|
||||||
|
# after test, turn full quote header back on again
|
||||||
|
tasks_close_all()
|
||||||
|
ticket_open_by_title(
|
||||||
|
title: 'Welcome to Zammad',
|
||||||
|
)
|
||||||
|
change_quote_config(
|
||||||
|
css: '.modal #ui_ticket_zoom_article_email_full_quote_header select[name="ui_ticket_zoom_article_email_full_quote_header"]',
|
||||||
|
value: 'yes',
|
||||||
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote_header .btn[type="submit"]',
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Regression test for issue #2344 - Missing translation for Full-Quote-Text "on xy wrote"
|
# Regression test for issue #2344 - Missing translation for Full-Quote-Text "on xy wrote"
|
||||||
|
@ -148,23 +190,11 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# enable email full quote in the ticket zoom config page
|
# enable email full quote in the ticket zoom config page
|
||||||
scroll_to(
|
change_quote_config(
|
||||||
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"]',
|
css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]',
|
||||||
value: 'yes'
|
value: 'yes',
|
||||||
|
submit_css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]',
|
||||||
)
|
)
|
||||||
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"]')
|
|
||||||
|
|
||||||
# switch user profile language to German
|
# switch user profile language to German
|
||||||
switch_language(
|
switch_language(
|
||||||
|
|
Loading…
Reference in a new issue