From f3011c709bcb436827d89c1c934cc3bff6114b1a Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Tue, 26 Jun 2018 05:07:32 +0530 Subject: [PATCH] Extract html content from lithium message template --- script/import_scripts/lithium.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/script/import_scripts/lithium.rb b/script/import_scripts/lithium.rb index d83fe105e37..0d057b8bbc9 100644 --- a/script/import_scripts/lithium.rb +++ b/script/import_scripts/lithium.rb @@ -903,6 +903,13 @@ SQL end def postprocess_post_raw(raw, user_id) + matches = raw.match(//m) + matches.each do |match| + hash = Hash.from_xml(match) + template = hash["messagetemplate"]["zone"]["item"] + content = (template[0] || template)["content"] || "" + raw.sub!(match, content) + end doc = Nokogiri::HTML.fragment(raw)