DEV: Convert min_trust_to_allow_self_wiki to groups (#25009)

We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_to_allow_self_wiki site setting to self_wiki_allowed_groups.

Nothing of note here. This is used in exactly one place, and there's no fallout.
This commit is contained in:
Ted Johansson
2023-12-27 09:21:39 +08:00
committed by GitHub
parent 3c818ff07e
commit b890eb1bd2
6 changed files with 39 additions and 3 deletions

View File

@ -332,7 +332,7 @@ module PostGuardian
return false unless authenticated?
return true if is_staff? || @user.has_trust_level?(TrustLevel[4])
if @user.has_trust_level?(SiteSetting.min_trust_to_allow_self_wiki) && is_my_own?(post)
if @user.in_any_groups?(SiteSetting.self_wiki_allowed_groups_map) && is_my_own?(post)
return false if post.hidden?
return !post.edit_time_limit_expired?(@user)
end