mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 10:17:15 +08:00
refactor User and TrustLevel a bit
* rename `User#password_required` to `User#password_required!` * emails with "i" @ something are a special case as well * get rid of `self.` and returns where possible * prefer "unless a" instead of "if !a" * `unread_notifications` without manually iterating * introduce `User#moderator?` * introduce `TrustLevel#valid_key?`, `TrustLevel#compare`, and `TrustLevel#level_key`
This commit is contained in:
@ -13,7 +13,7 @@ class Promotion
|
||||
# nil users are never promoted
|
||||
return false if @user.blank?
|
||||
|
||||
trust_key = TrustLevel.Levels.invert[@user.trust_level]
|
||||
trust_key = TrustLevel.level_key(@user.trust_level)
|
||||
|
||||
review_method = :"review_#{trust_key.to_s}"
|
||||
return send(review_method) if respond_to?(review_method)
|
||||
|
Reference in New Issue
Block a user