FIX: recalculating trust levels was not working (#20492)

The recalculate code was never firing cause TrustLevel.calculate unconditionally
returned a trust level. (albeit a wrong one)

New code ensures we only bypass promotion checks for cases where trust level
is locked.

see: https://meta.discourse.org/t/user-trust-level-resets-to-zero-when-unlocked/255444
This commit is contained in:
Sam
2023-03-01 15:35:21 +11:00
committed by GitHub
parent 8a2995f719
commit 71be74ffd3
5 changed files with 38 additions and 18 deletions

View File

@ -38,7 +38,7 @@ class TrustLevel
granted_trust_level = user.group_granted_trust_level || 0
previous_trust_level = use_previous_trust_level ? find_previous_trust_level(user) : 0
[granted_trust_level, previous_trust_level].max
[granted_trust_level, previous_trust_level, SiteSetting.default_trust_level].max
end
private