BUGFIX: make the system_user an elder (TL=4)

Otherwise it won't be able to create topic when the `min_trust_to_create_topic` is > 0
This commit is contained in:
Régis Hanol 2014-01-21 15:21:38 +01:00
parent 5a3c77abd9
commit 1fd71bb237
2 changed files with 7 additions and 7 deletions

View file

@ -22,4 +22,5 @@ User.seed do |u|
u.email_direct = false u.email_direct = false
u.approved = true u.approved = true
u.email_private_messages = false u.email_private_messages = false
u.trust_level = TrustLevel.levels[:elder]
end end

View file

@ -27,18 +27,17 @@ module TopicGuardian
# Creating Methods # Creating Methods
def can_create_topic?(parent) def can_create_topic?(parent)
user && user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i && can_create_post?(parent) user &&
user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i &&
can_create_post?(parent)
end end
def can_create_topic_on_category?(category) def can_create_topic_on_category?(category)
can_create_topic?(nil) && ( can_create_topic?(nil) &&
!category || (!category || Category.topic_create_allowed(self).where(:id => category.id).count == 1)
Category.topic_create_allowed(self).where(:id => category.id).count == 1
)
end end
def can_create_post_on_topic?(topic) def can_create_post_on_topic?(topic)
# No users can create posts on deleted topics # No users can create posts on deleted topics
return false if topic.trashed? return false if topic.trashed?