Improved shown delivery failed message.

This commit is contained in:
Martin Edenhofer 2016-06-27 13:24:48 +02:00
parent db6a3502b4
commit 8b9d917a1e
7 changed files with 39 additions and 7 deletions

View file

@ -359,7 +359,7 @@ class Table extends App.Controller
class: 'table--light'
bindRow:
events:
'click': openTicket
'click': openTicket
#bindCol:
# customer_id:
# events:

View file

@ -117,7 +117,8 @@ class ArticleViewItem extends App.ObserverController
article['html'] = App.Utils.text2html(body)
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')(
ticket: @ticket
article: article

View file

@ -58,7 +58,7 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
return
end
if !message
log_error(record, 'Unable to send email')
log_error(record, 'Unable to get sent email')
return
end
@ -113,13 +113,30 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
Rails.logger.error message
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_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send email: #{message}",
body: "Unable to send email to '#{recipient_list}'\n#{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,
)

View file

@ -77,6 +77,10 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,
)

View file

@ -87,6 +87,10 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,
)

View file

@ -651,8 +651,8 @@ perform changes on ticket
=end
def perform_changes(perform, log, item = nil)
logger.debug "Perform #{log} #{perform.inspect} on Ticket.find(#{id})"
def perform_changes(perform, perform_origin, item = nil)
logger.debug "Perform #{perform_origin} #{perform.inspect} on Ticket.find(#{id})"
changed = false
perform.each do |key, value|
(object_name, attribute) = key.split('.', 2)
@ -770,6 +770,9 @@ perform changes on ticket
internal: false,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'email'),
preferences: {
perform_origin: perform_origin,
},
updated_by_id: 1,
created_by_id: 1,
)

View file

@ -258,12 +258,15 @@ class EmailDeliverTest < ActiveSupport::TestCase
Scheduler.worker(true)
article2_lookup = Ticket::Article.find(article2.id)
article_delivery_system = ticket1.articles.last
assert_equal(3, ticket1.articles.count)
assert_equal('System', ticket1.articles.last.sender.name)
assert_equal(4, article2_lookup.preferences['delivery_retry'])
assert_equal('fail', article2_lookup.preferences['delivery_status'])
assert(article2_lookup.preferences['delivery_status_date'])
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