diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rb index 6a604a32636..df346bb5b73 100644 --- a/lib/cooked_post_processor.rb +++ b/lib/cooked_post_processor.rb @@ -18,13 +18,10 @@ class CookedPostProcessor # 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 @cooking_options = @cooking_options.symbolize_keys - @cooking_options[:omit_nofollow] = true if post.omit_nofollow? - @cooking_options[:cook_method] = post.cook_method analyzer = post.post_analyzer - @doc = Nokogiri::HTML::fragment(analyzer.cook(post.raw, @cooking_options)) + @doc = Nokogiri::HTML::fragment(post.cook(post.raw, @cooking_options)) @has_oneboxes = analyzer.found_oneboxes? @size_cache = {} end diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb index 6ad6b486d3c..fe0fcb45091 100644 --- a/spec/components/cooked_post_processor_spec.rb +++ b/spec/components/cooked_post_processor_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" require "cooked_post_processor" describe CookedPostProcessor do - context "#post_process" do let(:upload) do Fabricate(:upload, @@ -163,26 +162,6 @@ describe CookedPostProcessor do end end - context "cooking options" do - context "regular user" do - let(:post) { Fabricate(:post) } - - it "doesn't omit nofollow" do - cpp = CookedPostProcessor.new(post) - expect(cpp.cooking_options[:omit_nofollow]).to eq(nil) - end - end - - context "admin user" do - let(:post) { Fabricate(:post, user: Fabricate(:admin)) } - - it "omits nofollow" do - cpp = CookedPostProcessor.new(post) - expect(cpp.cooking_options[:omit_nofollow]).to eq(true) - end - end - end - context "#post_process_images" do before do diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 532781d7313..dce839102db 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -977,9 +977,15 @@ describe Post do ) end + before do + SiteSetting.queue_jobs = false + end + describe 'when user can not mention a group' do it "should not create the mention" do post = Fabricate(:post, raw: "hello @#{group.name}") + post.trigger_post_process + post.reload expect(post.cooked).to eq( %Q|
hello @#{group.name}
| @@ -994,6 +1000,8 @@ describe Post do it 'should create the mention' do post.update!(raw: "hello @#{group.name}") + post.trigger_post_process + post.reload expect(post.cooked).to eq( %Q|hello @#{group.name}
|