Add configurable upload limits
This commit is contained in:
@@ -24,8 +24,8 @@
|
|||||||
class UploadLimit
|
class UploadLimit
|
||||||
extend Memoist
|
extend Memoist
|
||||||
|
|
||||||
INITIAL_POINTS = 1000
|
INITIAL_POINTS = Danbooru.config.initial_upload_points
|
||||||
MAXIMUM_POINTS = 10_000
|
MAXIMUM_POINTS = Danbooru.config.maximum_upload_points
|
||||||
APPEAL_COST = 3
|
APPEAL_COST = 3
|
||||||
DELETION_COST = 5
|
DELETION_COST = 5
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ class UploadLimit
|
|||||||
|
|
||||||
# @return [Integer] The user's total number of upload slots. Ranges from 5 to 40.
|
# @return [Integer] The user's total number of upload slots. Ranges from 5 to 40.
|
||||||
def upload_slots
|
def upload_slots
|
||||||
upload_level + 5
|
upload_level + Danbooru.config.extra_upload_slots
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [Integer] The user's current upload level. Ranges from 0 to 35.
|
# @return [Integer] The user's current upload level. Ranges from 0 to 35.
|
||||||
@@ -121,7 +121,7 @@ class UploadLimit
|
|||||||
points += upload_value(points, is_deleted)
|
points += upload_value(points, is_deleted)
|
||||||
points = points.clamp(0, MAXIMUM_POINTS)
|
points = points.clamp(0, MAXIMUM_POINTS)
|
||||||
|
|
||||||
# warn "slots: %2d, points: %3d, value: %2d" % [UploadLimit.points_to_level(points) + 5, points, UploadLimit.upload_value(level, is_deleted)]
|
# warn "slots: %2d, points: %3d, value: %2d" % [UploadLimit.points_to_level(points) + Danbooru.config.extra_upload_slots, points, UploadLimit.upload_value(level, is_deleted)]
|
||||||
end
|
end
|
||||||
|
|
||||||
points
|
points
|
||||||
|
|||||||
@@ -174,7 +174,23 @@ module Danbooru
|
|||||||
# How long pending posts stay in the modqueue before being deleted.
|
# How long pending posts stay in the modqueue before being deleted.
|
||||||
def moderation_period
|
def moderation_period
|
||||||
3.days
|
3.days
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Upload points can be earned or lost by users. They punish and reward users by adding and removing upload slots.
|
||||||
|
# 1000 points is enough for 10 uploads. See app/logical/upload_limit.rb for details on the level system.
|
||||||
|
def initial_upload_points
|
||||||
|
1000
|
||||||
|
end
|
||||||
|
|
||||||
|
# The cap on how many upload points a user can earn.
|
||||||
|
def maximum_upload_points
|
||||||
|
10_000
|
||||||
|
end
|
||||||
|
|
||||||
|
# These slots are added to the ones earned by upload levels and guaranteed to all users, even those at level 0.
|
||||||
|
def extra_upload_slots
|
||||||
|
5
|
||||||
|
end
|
||||||
|
|
||||||
# https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
|
# https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
|
||||||
# https://guides.rubyonrails.org/configuring.html#configuring-action-mailer
|
# https://guides.rubyonrails.org/configuring.html#configuring-action-mailer
|
||||||
|
|||||||
Reference in New Issue
Block a user