FIX: do not allow creation of topic if there is no category available for posting (#7786)

This commit is contained in:
Arpit Jalan
2019-06-26 16:32:53 +05:30
committed by GitHub
parent 01de7e1444
commit 3c64dc3e7d
2 changed files with 36 additions and 1 deletions

View File

@@ -39,7 +39,8 @@ module TopicGuardian
is_staff? ||
(user &&
user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i &&
can_create_post?(parent))
can_create_post?(parent) &&
Category.topic_create_allowed(self).limit(1).count == 1)
end
def can_create_topic_on_category?(category)