mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FIX: Don't enqueue topics if the user can't create them
Co-authored-by: Vinoth Kannan <vinothkannan@vinkas.com>
This commit is contained in:
@ -104,6 +104,24 @@ describe NewPostManager do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a high approval post count and secure category' do
|
||||
it 'does not create topic' do
|
||||
SiteSetting.approve_post_count = 100
|
||||
user = Fabricate(:user)
|
||||
category_group = Fabricate(:category_group, permission_type: 2)
|
||||
group_user = Fabricate(:group_user, group: category_group.group, user_id: user.id)
|
||||
|
||||
manager = NewPostManager.new(
|
||||
user,
|
||||
raw: 'this is a new topic',
|
||||
title: "Let's start a new topic!",
|
||||
category: category_group.category_id
|
||||
)
|
||||
|
||||
expect(manager.perform.errors["base"][0]).to eq(I18n.t("js.errors.reasons.forbidden"))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a high trust level setting' do
|
||||
before do
|
||||
SiteSetting.approve_unless_trust_level = 4
|
||||
|
Reference in New Issue
Block a user