Extract html content from lithium message template

This commit is contained in:
Vinoth Kannan 2018-06-26 05:07:32 +05:30
parent acd1693dac
commit f3011c709b
1 changed files with 7 additions and 0 deletions

View File

@ -903,6 +903,13 @@ SQL
end
def postprocess_post_raw(raw, user_id)
matches = raw.match(/<messagetemplate.*<\/messagetemplate>/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)