A platform for community discussion. Free, open, simple.
FIX: Update excerpt after process_post (#12340)
David Taylorbce837db0c41
diff --git a/app/jobs/regular/process_post.rb b/app/jobs/regular/process_post.rbindex 9ff98cae223..3db96c694b0 100644--- a/app/jobs/regular/process_post.rb+++ b/app/jobs/regular/process_post.rb@@ -34,6 +34,7 @@ module JobsRails.logger.warn("Cooked post processor in FATAL state, bypassing. You need to urgently restart sidekiq\norig: #{orig_cooked}\nrecooked: #{recooked}\ncooked: #{cooked}\npost id: #{post.id}")elsepost.update_column(:cooked, cp.html)+ post.topic.update_excerpt(post.excerpt_for_topic) if post.is_first_post?extract_links(post)auto_tag(post) if SiteSetting.tagging_enabled? && post.post_number == 1post.publish_change_to_clients! :reviseddiff --git a/spec/jobs/process_post_spec.rb b/spec/jobs/process_post_spec.rbindex c6f8ecb395d..09a847fe964 100644--- a/spec/jobs/process_post_spec.rb+++ b/spec/jobs/process_post_spec.rb@@ -78,6 +78,18 @@ describe Jobs::ProcessPost doexpect(post.cooked).to eq(cooked)end+ it "updates the topic excerpt when first post" do+ post = Fabricate(:post, raw: "Some OP content", cooked: "")+ post.topic.update_excerpt("Incorrect")++ Jobs::ProcessPost.new.execute(post_id: post.id)+ expect(post.topic.reload.excerpt).to eq("Some OP content")++ post2 = Fabricate(:post, raw: "Some reply content", cooked: "", topic: post.topic)+ Jobs::ProcessPost.new.execute(post_id: post2.id)+ expect(post.topic.reload.excerpt).to eq("Some OP content")+ end+it "automatically tags first posts" doSiteSetting.tagging_enabled = true