mirror of
https://github.com/discourse/discourse.git
synced 2024-12-17 03:53:42 +08:00
19 lines
378 B
Ruby
19 lines
378 B
Ruby
class TrustLevelGranter
|
|
|
|
def initialize(trust_level, user)
|
|
@trust_level, @user = trust_level, user
|
|
end
|
|
|
|
def self.grant(trust_level, user)
|
|
TrustLevelGranter.new(trust_level, user).grant
|
|
end
|
|
|
|
def grant
|
|
if @user.trust_level < @trust_level
|
|
@user.change_trust_level!(@trust_level)
|
|
@user.trust_level_locked = true
|
|
@user.save!
|
|
end
|
|
end
|
|
end
|