FIX: admins should be able to create topics, even if min_trust_to_create_topic is higher than their trust level
This commit is contained in:
parent
b16c18e667
commit
4d50d0d109
|
@ -7,9 +7,10 @@ module TopicGuardian
|
|||
|
||||
# Creating Methods
|
||||
def can_create_topic?(parent)
|
||||
user &&
|
||||
is_admin? ||
|
||||
(user &&
|
||||
user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i &&
|
||||
can_create_post?(parent)
|
||||
can_create_post?(parent))
|
||||
end
|
||||
|
||||
def can_create_topic_on_category?(category)
|
||||
|
|
|
@ -414,6 +414,7 @@ describe Guardian do
|
|||
SiteSetting.stubs(:min_trust_to_create_topic).returns(1)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue