diff --git a/app/models/reviewable_queued_post.rb b/app/models/reviewable_queued_post.rb index 7132282fe5a..4e1cbd1507e 100644 --- a/app/models/reviewable_queued_post.rb +++ b/app/models/reviewable_queued_post.rb @@ -108,6 +108,7 @@ class ReviewableQueuedPost < Reviewable skip_jobs: true, skip_events: true, skip_guardian: true, + reviewed_queued_post: true, ) opts.merge!(guardian: Guardian.new(performed_by)) if performed_by.staff? diff --git a/lib/post_creator.rb b/lib/post_creator.rb index 5af9c148661..6d15e678444 100644 --- a/lib/post_creator.rb +++ b/lib/post_creator.rb @@ -222,7 +222,7 @@ class PostCreator auto_close end - if !opts[:import_mode] + if !opts[:import_mode] && !opts[:reviewed_queued_post] handle_spam if (@spam || @post) ReviewablePost.queue_for_review_if_possible(@post, @user) if !@spam && @post && errors.blank? diff --git a/spec/lib/post_creator_spec.rb b/spec/lib/post_creator_spec.rb index 652b062ad18..48f2b2dfdb1 100644 --- a/spec/lib/post_creator_spec.rb +++ b/spec/lib/post_creator_spec.rb @@ -2167,4 +2167,28 @@ RSpec.describe PostCreator do expect { post_creator.create }.not_to change(ReviewablePost, :count) end end + + context "when the review_every_post setting is enabled and category requires topic approval" do + fab!(:category) + + before do + category.require_topic_approval = true + category.save! + end + + before { SiteSetting.review_every_post = true } + + it "creates single reviewable item" do + manager = + NewPostManager.new( + user, + title: "this is a new title", + raw: "this is a new post", + category: category.id, + ) + reviewable = manager.perform.reviewable + + expect { reviewable.perform(admin, :approve_post) }.not_to change(ReviewablePost, :count) + end + end end