Revert "FIX: Don't enqueue topics if the user can't create them"

This reverts commit 515e103db6.
This commit is contained in:
Sam 2018-11-09 15:25:38 +11:00
parent e6b3310577
commit 7d52f5869d
2 changed files with 0 additions and 26 deletions

View File

@ -119,14 +119,6 @@ class NewPostManager
result.errors[:base] << I18n.t(:topic_not_found) result.errors[:base] << I18n.t(:topic_not_found)
return result return result
end end
elsif manager.args[:category]
category = Category.find_by_id(manager.args[:category])
unless manager.user.guardian.can_create_topic_on_category?(category)
result = NewPostResult.new(:created_post, false)
result.errors[:base] << I18n.t("js.errors.reasons.forbidden")
return result
end
end end
result = manager.enqueue('default') result = manager.enqueue('default')

View File

@ -104,24 +104,6 @@ describe NewPostManager do
end end
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 context 'with a high trust level setting' do
before do before do
SiteSetting.approve_unless_trust_level = 4 SiteSetting.approve_unless_trust_level = 4