Moderators should always be able to create topics too

This commit is contained in:
Neil Lalonde 2014-06-09 15:21:01 -04:00
parent f97d434174
commit faed17aa18
2 changed files with 2 additions and 1 deletions

View File

@ -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))

View File

@ -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