Improved shown delivery failed message.
This commit is contained in:
parent
db6a3502b4
commit
8b9d917a1e
7 changed files with 39 additions and 7 deletions
|
@ -359,7 +359,7 @@ class Table extends App.Controller
|
||||||
class: 'table--light'
|
class: 'table--light'
|
||||||
bindRow:
|
bindRow:
|
||||||
events:
|
events:
|
||||||
'click': openTicket
|
'click': openTicket
|
||||||
#bindCol:
|
#bindCol:
|
||||||
# customer_id:
|
# customer_id:
|
||||||
# events:
|
# events:
|
||||||
|
|
|
@ -117,7 +117,8 @@ class ArticleViewItem extends App.ObserverController
|
||||||
article['html'] = App.Utils.text2html(body)
|
article['html'] = App.Utils.text2html(body)
|
||||||
article['html'] = article['html'].replace(signatureDetected, '<span class="js-signatureMarker"></span>')
|
article['html'] = article['html'].replace(signatureDetected, '<span class="js-signatureMarker"></span>')
|
||||||
|
|
||||||
if article.sender.name is 'System'
|
if article.sender.name is 'System' && !article.preferences.delivery_message
|
||||||
|
#if article.sender.name is 'System' && article.preferences.perform_origin is 'trigger'
|
||||||
@html App.view('ticket_zoom/article_view_system')(
|
@html App.view('ticket_zoom/article_view_system')(
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
article: article
|
article: article
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if !message
|
if !message
|
||||||
log_error(record, 'Unable to send email')
|
log_error(record, 'Unable to get sent email')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -113,13 +113,30 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
Rails.logger.error message
|
Rails.logger.error message
|
||||||
|
|
||||||
if local_record.preferences['delivery_retry'] > 3
|
if local_record.preferences['delivery_retry'] > 3
|
||||||
|
|
||||||
|
recipient_list = ''
|
||||||
|
[:to, :cc].each { |key|
|
||||||
|
|
||||||
|
next if !local_record[key]
|
||||||
|
next if local_record[key] == ''
|
||||||
|
|
||||||
|
if recipient_list != ''
|
||||||
|
recipient_list += ','
|
||||||
|
end
|
||||||
|
recipient_list += local_record[key]
|
||||||
|
}
|
||||||
|
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
ticket_id: local_record.ticket_id,
|
ticket_id: local_record.ticket_id,
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
body: "Unable to send email: #{message}",
|
body: "Unable to send email to '#{recipient_list}'\n#{message}",
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
|
preferences: {
|
||||||
|
delivery_article_id_related: local_record.id,
|
||||||
|
delivery_message: true,
|
||||||
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
|
|
@ -77,6 +77,10 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
|
preferences: {
|
||||||
|
delivery_article_id_related: local_record.id,
|
||||||
|
delivery_message: true,
|
||||||
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
|
|
@ -87,6 +87,10 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
|
preferences: {
|
||||||
|
delivery_article_id_related: local_record.id,
|
||||||
|
delivery_message: true,
|
||||||
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
|
|
@ -651,8 +651,8 @@ perform changes on ticket
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def perform_changes(perform, log, item = nil)
|
def perform_changes(perform, perform_origin, item = nil)
|
||||||
logger.debug "Perform #{log} #{perform.inspect} on Ticket.find(#{id})"
|
logger.debug "Perform #{perform_origin} #{perform.inspect} on Ticket.find(#{id})"
|
||||||
changed = false
|
changed = false
|
||||||
perform.each do |key, value|
|
perform.each do |key, value|
|
||||||
(object_name, attribute) = key.split('.', 2)
|
(object_name, attribute) = key.split('.', 2)
|
||||||
|
@ -770,6 +770,9 @@ perform changes on ticket
|
||||||
internal: false,
|
internal: false,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'email'),
|
type: Ticket::Article::Type.find_by(name: 'email'),
|
||||||
|
preferences: {
|
||||||
|
perform_origin: perform_origin,
|
||||||
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
|
|
@ -258,12 +258,15 @@ class EmailDeliverTest < ActiveSupport::TestCase
|
||||||
Scheduler.worker(true)
|
Scheduler.worker(true)
|
||||||
|
|
||||||
article2_lookup = Ticket::Article.find(article2.id)
|
article2_lookup = Ticket::Article.find(article2.id)
|
||||||
|
article_delivery_system = ticket1.articles.last
|
||||||
assert_equal(3, ticket1.articles.count)
|
assert_equal(3, ticket1.articles.count)
|
||||||
assert_equal('System', ticket1.articles.last.sender.name)
|
|
||||||
assert_equal(4, article2_lookup.preferences['delivery_retry'])
|
assert_equal(4, article2_lookup.preferences['delivery_retry'])
|
||||||
assert_equal('fail', article2_lookup.preferences['delivery_status'])
|
assert_equal('fail', article2_lookup.preferences['delivery_status'])
|
||||||
assert(article2_lookup.preferences['delivery_status_date'])
|
assert(article2_lookup.preferences['delivery_status_date'])
|
||||||
assert(article2_lookup.preferences['delivery_status_message'])
|
assert(article2_lookup.preferences['delivery_status_message'])
|
||||||
|
assert_equal('System', article_delivery_system.sender.name)
|
||||||
|
assert_equal(true, article_delivery_system.preferences['delivery_message'])
|
||||||
|
assert_equal(article2.id, article_delivery_system.preferences['delivery_article_id_related'])
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue