FIX: category id wasn't stored when enqueueing a topic

This commit is contained in:
Robin Ward 2019-04-02 11:11:43 -04:00
parent ef3dd83367
commit 123c05cb07
2 changed files with 22 additions and 0 deletions

View File

@ -188,6 +188,7 @@ class NewPostManager
reviewable_by_moderator: true reviewable_by_moderator: true
) )
reviewable.payload['title'] = @args[:title] if @args[:title].present? reviewable.payload['title'] = @args[:title] if @args[:title].present?
reviewable.category_id = args[:category] if args[:category].present?
create_options = reviewable.create_options create_options = reviewable.create_options

View File

@ -133,6 +133,27 @@ describe NewPostManager do
end end
end end
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' do context 'with staged moderation setting enabled' do
before do before do
SiteSetting.approve_unless_staged = true SiteSetting.approve_unless_staged = true