FEATURE: allow users to wikify their own posts based on trust level

This commit is contained in:
Arpit Jalan
2016-01-11 20:56:00 +05:30
parent 19c630e7c2
commit 06bac23e5f
10 changed files with 65 additions and 21 deletions

View File

@@ -173,8 +173,9 @@ module PostGuardian
is_admin?
end
def can_wiki?
is_staff? || @user.has_trust_level?(TrustLevel[4])
def can_wiki?(post)
return false unless authenticated?
is_staff? || @user.has_trust_level?(TrustLevel[4]) || (@user.has_trust_level?(SiteSetting.min_trust_to_allow_self_wiki) && is_my_own?(post))
end
def can_change_post_type?