A platform for community discussion. Free, open, simple.
FIX: category id wasn't stored when enqueueing a topic
Robin Ward123c05cb0700
diff --git a/lib/new_post_manager.rb b/lib/new_post_manager.rbindex 92baa71cce4..c99abea3542 100644--- a/lib/new_post_manager.rb+++ b/lib/new_post_manager.rb@@ -188,6 +188,7 @@ class NewPostManagerreviewable_by_moderator: true)reviewable.payload['title'] = @args[:title] if @args[:title].present?+ reviewable.category_id = args[:category] if args[:category].present?create_options = reviewable.create_optionsdiff --git a/spec/components/new_post_manager_spec.rb b/spec/components/new_post_manager_spec.rbindex c1a3efcb418..bc35f00730c 100644--- a/spec/components/new_post_manager_spec.rb+++ b/spec/components/new_post_manager_spec.rb@@ -133,6 +133,27 @@ describe NewPostManager doendend+ context "with uncategorized disabled, and approval" do+ before do+ SiteSetting.allow_uncategorized_topics = false+ SiteSetting.approve_unless_trust_level = 4+ end++ it "will return an enqueue result" do+ npm = NewPostManager.new(+ Fabricate(:user),+ title: 'this is a new topic title',+ raw: "this is the raw content",+ category: Fabricate(:category).id+ )++ result = NewPostManager.default_handler(npm)+ expect(NewPostManager.queue_enabled?).to eq(true)+ expect(result.action).to eq(:enqueued)+ expect(result.errors).to be_blank+ end+ end+context 'with staged moderation setting enabled' dobefore doSiteSetting.approve_unless_staged = true