Fix #4689: Remove 7 day waiting period for new uploaders.
This commit is contained in:
@@ -13,23 +13,7 @@ class UploadLimit
|
|||||||
end
|
end
|
||||||
|
|
||||||
def limited?
|
def limited?
|
||||||
if user.can_upload_free?
|
!user.can_upload_free? && used_upload_slots >= upload_slots
|
||||||
false
|
|
||||||
elsif user.created_at > 1.week.ago
|
|
||||||
true
|
|
||||||
else
|
|
||||||
used_upload_slots >= upload_slots
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def limit_reason
|
|
||||||
if user.created_at > 1.week.ago
|
|
||||||
"cannot upload during your first week of registration"
|
|
||||||
elsif limited?
|
|
||||||
"have reached your upload limit"
|
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def maxed?
|
def maxed?
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class Post < ApplicationRecord
|
|||||||
scope :pending, -> { where(is_pending: true) }
|
scope :pending, -> { where(is_pending: true) }
|
||||||
scope :flagged, -> { where(is_flagged: true) }
|
scope :flagged, -> { where(is_flagged: true) }
|
||||||
scope :banned, -> { where(is_banned: true) }
|
scope :banned, -> { where(is_banned: true) }
|
||||||
|
# XXX conflict with deletable
|
||||||
scope :active, -> { where(is_pending: false, is_deleted: false, is_flagged: false).where.not(id: PostAppeal.pending) }
|
scope :active, -> { where(is_pending: false, is_deleted: false, is_flagged: false).where.not(id: PostAppeal.pending) }
|
||||||
scope :appealed, -> { deleted.where(id: PostAppeal.pending.select(:post_id)) }
|
scope :appealed, -> { deleted.where(id: PostAppeal.pending.select(:post_id)) }
|
||||||
scope :in_modqueue, -> { pending.or(flagged).or(appealed) }
|
scope :in_modqueue, -> { pending.or(flagged).or(appealed) }
|
||||||
@@ -1389,7 +1390,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def uploader_is_not_limited
|
def uploader_is_not_limited
|
||||||
errors.add(:uploader, uploader.upload_limit.limit_reason) if uploader.upload_limit.limited?
|
errors.add(:uploader, "have reached your upload limit") if uploader.upload_limit.limited?
|
||||||
end
|
end
|
||||||
|
|
||||||
def added_tags_are_valid
|
def added_tags_are_valid
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
<div id="a-new" data-image-size="small">
|
<div id="a-new" data-image-size="small">
|
||||||
<h1>Upload</h1>
|
<h1>Upload</h1>
|
||||||
|
|
||||||
<% if !CurrentUser.user.upload_limit.limited? %>
|
<% if CurrentUser.user.upload_limit.limited? %>
|
||||||
|
<h2 style="margin-bottom: 1em;">You have reached your upload limit</h2>
|
||||||
|
<% else %>
|
||||||
<%= embed_wiki("help:upload_notice", id: "upload-guide-notice") %>
|
<%= embed_wiki("help:upload_notice", id: "upload-guide-notice") %>
|
||||||
|
|
||||||
<% unless CurrentUser.can_upload_free? %>
|
<% unless CurrentUser.can_upload_free? %>
|
||||||
@@ -79,8 +81,6 @@
|
|||||||
|
|
||||||
<%= render "related_tags/container" %>
|
<%= render "related_tags/container" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
|
||||||
<h2 style="margin-bottom: 1em;">You <%= CurrentUser.user.upload_limit.limit_reason %></h2>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user