Fixed issue #2253 - Unable to index elasticsearch if article.preferences[:delivery_status_message] has no utf8 charset.

This commit is contained in:
Martin Edenhofer 2018-09-24 15:21:21 +02:00
parent 1568909afb
commit 567daf0053
4 changed files with 4 additions and 4 deletions

View file

@ -121,7 +121,7 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
local_record.preferences['delivery_channel_id'] = channel.id local_record.preferences['delivery_channel_id'] = channel.id
end end
local_record.preferences['delivery_status'] = 'fail' local_record.preferences['delivery_status'] = 'fail'
local_record.preferences['delivery_status_message'] = message local_record.preferences['delivery_status_message'] = message.encode!('UTF-8', 'UTF-8', invalid: :replace, replace: '?')
local_record.preferences['delivery_status_date'] = Time.zone.now local_record.preferences['delivery_status_date'] = Time.zone.now
local_record.save! local_record.save!
Rails.logger.error message Rails.logger.error message

View file

@ -66,7 +66,7 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob
def log_error(local_record, message) def log_error(local_record, message)
local_record.preferences['delivery_status'] = 'fail' local_record.preferences['delivery_status'] = 'fail'
local_record.preferences['delivery_status_message'] = message local_record.preferences['delivery_status_message'] = message.encode!('UTF-8', 'UTF-8', invalid: :replace, replace: '?')
local_record.preferences['delivery_status_date'] = Time.zone.now local_record.preferences['delivery_status_date'] = Time.zone.now
local_record.save local_record.save
Rails.logger.error message Rails.logger.error message

View file

@ -87,7 +87,7 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
def log_error(local_record, message) def log_error(local_record, message)
local_record.preferences['delivery_status'] = 'fail' local_record.preferences['delivery_status'] = 'fail'
local_record.preferences['delivery_status_message'] = message local_record.preferences['delivery_status_message'] = message.encode!('UTF-8', 'UTF-8', invalid: :replace, replace: '?')
local_record.preferences['delivery_status_date'] = Time.zone.now local_record.preferences['delivery_status_date'] = Time.zone.now
local_record.save local_record.save
Rails.logger.error message Rails.logger.error message

View file

@ -105,7 +105,7 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
def log_error(local_record, message) def log_error(local_record, message)
local_record.preferences['delivery_status'] = 'fail' local_record.preferences['delivery_status'] = 'fail'
local_record.preferences['delivery_status_message'] = message local_record.preferences['delivery_status_message'] = message.encode!('UTF-8', 'UTF-8', invalid: :replace, replace: '?')
local_record.preferences['delivery_status_date'] = Time.zone.now local_record.preferences['delivery_status_date'] = Time.zone.now
local_record.save local_record.save
Rails.logger.error message Rails.logger.error message