diff --git a/db/fixtures/005_users.rb b/db/fixtures/005_users.rb index 8122c3c1ec8..d71aae88d37 100644 --- a/db/fixtures/005_users.rb +++ b/db/fixtures/005_users.rb @@ -22,4 +22,5 @@ User.seed do |u| u.email_direct = false u.approved = true u.email_private_messages = false + u.trust_level = TrustLevel.levels[:elder] end diff --git a/lib/guardian/topic_guardian.rb b/lib/guardian/topic_guardian.rb index 9a6cc285bce..50d240de27d 100644 --- a/lib/guardian/topic_guardian.rb +++ b/lib/guardian/topic_guardian.rb @@ -27,18 +27,17 @@ module TopicGuardian # Creating Methods 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 def can_create_topic_on_category?(category) - can_create_topic?(nil) && ( - !category || - Category.topic_create_allowed(self).where(:id => category.id).count == 1 - ) + can_create_topic?(nil) && + (!category || Category.topic_create_allowed(self).where(:id => category.id).count == 1) end def can_create_post_on_topic?(topic) - # No users can create posts on deleted topics return false if topic.trashed? @@ -82,4 +81,4 @@ module TopicGuardian (not(topic.private_message?) || authenticated? && (topic.all_allowed_users.where(id: @user.id).exists? || is_staff?)) end end -end \ No newline at end of file +end