From faed17aa181836c0dbe6ca85ff832f80e127f0bf Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 9 Jun 2014 15:21:01 -0400 Subject: [PATCH] Moderators should always be able to create topics too --- lib/guardian/topic_guardian.rb | 2 +- spec/components/guardian_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/guardian/topic_guardian.rb b/lib/guardian/topic_guardian.rb index f691942bc8..1f767fbc50 100644 --- a/lib/guardian/topic_guardian.rb +++ b/lib/guardian/topic_guardian.rb @@ -7,7 +7,7 @@ module TopicGuardian # Creating Methods def can_create_topic?(parent) - is_admin? || + is_staff? || (user && user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i && can_create_post?(parent)) diff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rb index e6e4e95fdc..45be1d7d93 100644 --- a/spec/components/guardian_spec.rb +++ b/spec/components/guardian_spec.rb @@ -415,6 +415,7 @@ describe Guardian do Guardian.new(build(:user, trust_level: 1)).can_create?(Topic,Fabricate(:category)).should be_true Guardian.new(build(:user, trust_level: 2)).can_create?(Topic,Fabricate(:category)).should be_true Guardian.new(build(:admin, trust_level: 0)).can_create?(Topic,Fabricate(:category)).should be_true + Guardian.new(build(:moderator, trust_level: 0)).can_create?(Topic,Fabricate(:category)).should be_true end end