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:
evazion
2020-08-08 10:37:51 -05:00
parent 3a17b5a13e
commit e8dcc9c56e
4 changed files with 48 additions and 31 deletions

View File

@@ -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