Fixes #3824 - Email address not shown inside forwarded email
This commit is contained in:
parent
44422c5357
commit
e21d6c5414
2 changed files with 32 additions and 11 deletions
|
@ -28,7 +28,7 @@ class App.FullQuoteHeader
|
||||||
|
|
||||||
@fullQuoteHeaderForwardTo: (article) ->
|
@fullQuoteHeaderForwardTo: (article) ->
|
||||||
if article.type.name is 'email' || article.type.name is 'web'
|
if article.type.name is 'email' || article.type.name is 'web'
|
||||||
@fullQuoteHeaderEnsurePrivacy(article.to) || article.to
|
@fullQuoteHeaderEnsureMultiPrivacy(article.to)
|
||||||
else if article.sender.name is 'Customer' && article.type.name is 'phone'
|
else if article.sender.name is 'Customer' && article.type.name is 'phone'
|
||||||
if email_address_id = App.Group.findByAttribute('name', article.to)?.email_address_id
|
if email_address_id = App.Group.findByAttribute('name', article.to)?.email_address_id
|
||||||
App.EmailAddress.find(email_address_id).displayName()
|
App.EmailAddress.find(email_address_id).displayName()
|
||||||
|
@ -36,15 +36,17 @@ class App.FullQuoteHeader
|
||||||
article.to
|
article.to
|
||||||
else if article.sender.name is 'Agent' && article.type.name is 'phone'
|
else if article.sender.name is 'Agent' && article.type.name is 'phone'
|
||||||
ticket = App.Ticket.find article.ticket_id
|
ticket = App.Ticket.find article.ticket_id
|
||||||
@fullQuoteHeaderEnsurePrivacy(ticket.customer_id) || @fullQuoteHeaderEnsurePrivacy(article.to) || article.to
|
@fullQuoteHeaderEnsurePrivacy(ticket.customer_id) || @fullQuoteHeaderEnsureMultiPrivacy(article.to)
|
||||||
else
|
else
|
||||||
article.to
|
article.to
|
||||||
|
|
||||||
@fullQuoteHeaderForwardCC: (article) ->
|
@fullQuoteHeaderForwardCC: (article) ->
|
||||||
return if !article.cc
|
return if !article.cc
|
||||||
|
|
||||||
article
|
@fullQuoteHeaderEnsureMultiPrivacy(article.cc)
|
||||||
.cc
|
|
||||||
|
@fullQuoteHeaderEnsureMultiPrivacy: (input) ->
|
||||||
|
input
|
||||||
.split(',')
|
.split(',')
|
||||||
.map (elem) ->
|
.map (elem) ->
|
||||||
elem.trim()
|
elem.trim()
|
||||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
context 'when "ui_ticket_zoom_article_email_full_quote_header" is enabled' do
|
context 'when "ui_ticket_zoom_article_email_full_quote_header" is enabled' do
|
||||||
let(:full_quote_header_setting) { true }
|
let(:full_quote_header_setting) { true }
|
||||||
|
|
||||||
it 'includes OP when forwarding' do
|
it 'includes sender when forwarding' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
click_forward
|
click_forward
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'includes OP when replying' do
|
it 'includes sender when replying' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
highlight_and_click_reply
|
highlight_and_click_reply
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'includes OP when article visibility toggled' do
|
it 'includes sender when article visibility toggled' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
set_internal
|
set_internal
|
||||||
highlight_and_click_reply
|
highlight_and_click_reply
|
||||||
|
@ -55,7 +55,7 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
context 'when customer is agent' do
|
context 'when customer is agent' do
|
||||||
let(:customer) { create(:agent) }
|
let(:customer) { create(:agent) }
|
||||||
|
|
||||||
it 'includes OP without email when forwarding' do
|
it 'includes sender without email when forwarding' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
click_forward
|
click_forward
|
||||||
|
|
||||||
|
@ -66,13 +66,32 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# https://github.com/zammad/zammad/issues/3824
|
||||||
|
context 'when TO contains multiple senders and one of them is a known Zammad user' do
|
||||||
|
let(:customer) { create(:customer) }
|
||||||
|
let(:to_1) { "#{customer.fullname} <#{customer.email}>" }
|
||||||
|
let(:to_2) { 'Example Two <two@example.org>' }
|
||||||
|
|
||||||
|
let(:ticket_article) { create(:ticket_article, ticket: ticket, to: [to_1, to_2].join(', ')) }
|
||||||
|
|
||||||
|
it 'includes all TO email address' do
|
||||||
|
within(:active_content) do
|
||||||
|
click_forward
|
||||||
|
|
||||||
|
within(:richtext) do
|
||||||
|
expect(page).to have_text(to_1).and(have_text(to_2))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'ticket is created by agent on behalf of customer' do
|
context 'ticket is created by agent on behalf of customer' do
|
||||||
let(:agent) { create(:agent) }
|
let(:agent) { create(:agent) }
|
||||||
let(:current_user) { agent }
|
let(:current_user) { agent }
|
||||||
let(:ticket) { create(:ticket, group: group, title: 'Created by agent on behalf of a customer', customer: customer) }
|
let(:ticket) { create(:ticket, group: group, title: 'Created by agent on behalf of a customer', customer: customer) }
|
||||||
let(:ticket_article) { create(:ticket_article, ticket: ticket, from: 'Created by agent on behalf of a customer', origin_by_id: customer.id) }
|
let(:ticket_article) { create(:ticket_article, ticket: ticket, from: 'Created by agent on behalf of a customer', origin_by_id: customer.id) }
|
||||||
|
|
||||||
it 'includes OP without email when replying' do
|
it 'includes sender without email when replying' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
highlight_and_click_reply
|
highlight_and_click_reply
|
||||||
|
|
||||||
|
@ -87,7 +106,7 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
context 'when "ui_ticket_zoom_article_email_full_quote_header" is disabled' do
|
context 'when "ui_ticket_zoom_article_email_full_quote_header" is disabled' do
|
||||||
let(:full_quote_header_setting) { false }
|
let(:full_quote_header_setting) { false }
|
||||||
|
|
||||||
it 'does not include OP when forwarding' do
|
it 'does not include sender when forwarding' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
click_forward
|
click_forward
|
||||||
|
|
||||||
|
@ -97,7 +116,7 @@ RSpec.describe 'Ticket > Update > Full Quote Header', current_user_id: -> { curr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not include OP when replying' do
|
it 'does not include sender when replying' do
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
highlight_and_click_reply
|
highlight_and_click_reply
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue