implement new user limiting

This commit is contained in:
albert
2013-03-21 15:48:48 -07:00
parent 8caf7fd796
commit 851ab1d256
2 changed files with 13 additions and 3 deletions

View File

@@ -438,9 +438,9 @@ class User < ActiveRecord::Base
approved_count = Post.where("is_flagged = false and is_pending = false and is_deleted = false and uploader_id = ? and created_at >= ?", id, 1.month.ago).count
if base_upload_limit
limit = base_upload_limit - (deleted_count / 5) - pending_count
limit = [base_upload_limit - (deleted_count / 2), 4].max - pending_count
else
limit = 10 + (approved_count / 10) - (deleted_count / 5) - pending_count
limit = [10 + [approved_count / 2, 20].min - (deleted_count / 2), 4].max - pending_count
end
if limit < 0