move user promotion to scoped user block

This commit is contained in:
r888888888
2014-12-03 12:52:17 -08:00
parent cdc6467a91
commit 63193593d9

View File

@@ -18,8 +18,8 @@ class UserUploadClamper
def clamp_user!(user)
upload_limit = (Post.for_user(user).deleted.where("is_banned = false").count / 4) + 10
user.update_attribute(:base_upload_limit, upload_limit)
user.promote_to!(User::Levels::BUILDER) if user.is_contributor?
CurrentUser.scoped(User.admins.first, "127.0.0.1") do
user.promote_to!(User::Levels::BUILDER) if user.is_contributor?
Dmail.create_split(:to_id => user.id, :title => "Post Upload Limit", :body => "You are receiving this message because a large percentage of your uploads are being deleted. For this reason you will now be limited to 10 uploads a day.")
ModAction.create(:description => "user ##{user.id} (#{user.name}) clamped")
end