mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 09:13:45 +08:00
FIX: category id wasn't stored when enqueueing a topic
This commit is contained in:
parent
ef3dd83367
commit
123c05cb07
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user