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 b2f777bea..f8761af0f 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
@@ -149,11 +149,14 @@ class EmailReply extends App.Controller
selected = App.Utils.text2html(selected)
if selected
- date = @date_format(article.created_at)
- name = article.updated_by.displayName()
- email = article.updated_by.email
- quote_header = App.i18n.translateInline('On %s, %s wrote:', date, name)
- selected = "
#{quote_header}
#{selected}
"
+ quote_header = ''
+ if App.Config.get('ui_ticket_zoom_article_email_full_quote_header')
+ date = @date_format(article.created_at)
+ name = article.updated_by.displayName()
+ email = article.updated_by.email
+ quote_header = App.i18n.translateInline('On %s, %s wrote:', date, name) + '
'
+
+ selected = "
#{quote_header}#{selected}
"
# add selected text to body
body = selected + body
diff --git a/db/migrate/20181203000000_setting_add_email_full_quote_header.rb b/db/migrate/20181203000000_setting_add_email_full_quote_header.rb
new file mode 100644
index 000000000..937d2c9d6
--- /dev/null
+++ b/db/migrate/20181203000000_setting_add_email_full_quote_header.rb
@@ -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
diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb
index 3ae0d3450..f00f9a681 100644
--- a/db/seeds/settings.rb
+++ b/db/seeds/settings.rb
@@ -699,6 +699,33 @@ Setting.create_if_not_exists(
},
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(
title: 'Twitter - tweet initials',
name: 'ui_ticket_zoom_article_twitter_initials',
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 ad06a411c..ff601be19 100644
--- a/test/browser/agent_ticket_email_reply_keep_body_test.rb
+++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb
@@ -79,6 +79,24 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
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
@browser = instance = browser_instance
login(
@@ -96,30 +114,21 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
)
# 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(
+ change_quote_config(
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"]',
+ 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"]',
)
- 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
@@ -128,6 +137,39 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
assert match
assert 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
# 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
- 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(
+ change_quote_config(
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_language(