appeals: raise appeal limits.
The old limit was one appeal per day. The new limit is based on your upload limit. Each appeal costs 3 upload slots. If you have 15 upload slots, then you can appeal up to 5 posts at once, but you won't be able to appeal or upload more until your appeals are approved or rejected. If you have unlimited uploads, then you have unlimited appeals.
This commit is contained in:
@@ -3,6 +3,7 @@ class UploadLimit
|
||||
|
||||
INITIAL_POINTS = 1000
|
||||
MAXIMUM_POINTS = 10_000
|
||||
APPEAL_COST = 3
|
||||
|
||||
attr_reader :user
|
||||
|
||||
@@ -31,10 +32,15 @@ class UploadLimit
|
||||
end
|
||||
|
||||
def used_upload_slots
|
||||
pending = user.posts.pending
|
||||
early_deleted = user.posts.deleted.where("created_at >= ?", 3.days.ago)
|
||||
pending_count = user.posts.pending.count
|
||||
appealed_count = user.post_appeals.pending.count
|
||||
early_deleted_count = user.posts.deleted.where("created_at >= ?", 3.days.ago).count
|
||||
|
||||
pending.or(early_deleted).count
|
||||
pending_count + early_deleted_count + (appealed_count * APPEAL_COST)
|
||||
end
|
||||
|
||||
def free_upload_slots
|
||||
upload_slots - used_upload_slots
|
||||
end
|
||||
|
||||
def upload_slots
|
||||
@@ -111,6 +117,4 @@ class UploadLimit
|
||||
points_for_next_level(n - 1)
|
||||
end.sum
|
||||
end
|
||||
|
||||
memoize :used_upload_slots
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user