FIX: timing issue with edits and cook post processing

This commit is contained in:
Régis Hanol
2015-09-29 18:51:26 +02:00
parent 3aaa9a8722
commit 54d6d24cbf
9 changed files with 30 additions and 32 deletions

View File

@ -11,7 +11,11 @@ class CookedPostProcessor
@opts = opts
@post = post
@previous_cooked = (@post.cooked || "").dup
@doc = Nokogiri::HTML::fragment(post.cooked)
# NOTE: we re-cook the post here in order to prevent timing issues with edits
# cf. https://meta.discourse.org/t/edit-of-rebaked-post-doesnt-show-in-html-only-in-raw/33815/6
cooking_options = post.cooking_options || opts[:cooking_options] || {}
cooking_options[:topic_id] = post.topic_id
@doc = Nokogiri::HTML::fragment(post.cook(post.raw, cooking_options.symbolize_keys))
@size_cache = {}
end