From 8900c2bb1f024c23fbd693f6842e18c2617ea211 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 2 Jun 2016 20:58:46 +0200 Subject: [PATCH] Allow to set created_at and updated_at via x-header. --- app/models/channel/email_parser.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index 4f82ac9d2..df08669ad 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -243,6 +243,15 @@ class Channel::EmailParser data[:body].gsub!(/\r\n/, "\n") data[:body].tr!("\r", "\n") + # get mail date + begin + if mail.date + data[:date] = Time.zone.parse(mail.date.to_s) + end + rescue + data[:date] = nil + end + # remember original mail instance data[:mail_instance] = mail @@ -372,6 +381,7 @@ retrns filters[setting.name] = Kernel.const_get(Setting.get(setting.name)) } filters.each {|_prio, backend| + Rails.logger.debug "run postmaster pre filter #{backend}" begin backend.run(channel, mail) rescue => e @@ -526,6 +536,7 @@ retrns filters[setting.name] = Kernel.const_get(Setting.get(setting.name)) } filters.each {|_prio, backend| + Rails.logger.debug "run postmaster post filter #{backend}" begin backend.run(channel, mail, ticket, article, user) rescue => e @@ -544,8 +555,6 @@ retrns item_object.attributes.each {|key, _value| # ignore read only attributes - next if key == 'updated_at' - next if key == 'created_at' next if key == 'updated_by_id' next if key == 'created_by_id'