Moderators should always be able to create topics too
This commit is contained in:
parent
f97d434174
commit
faed17aa18
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue