upload limits: add time remaining until next upload to profiles (fix #3262).
This commit is contained in:
@@ -585,6 +585,10 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def next_free_upload_slot
|
||||||
|
(posts.where("created_at >= ?", 24.hours.ago).first.try(:created_at) || 24.hours.ago) + 24.hours
|
||||||
|
end
|
||||||
|
|
||||||
def tag_query_limit
|
def tag_query_limit
|
||||||
if is_platinum?
|
if is_platinum?
|
||||||
Danbooru.config.base_tag_query_limit * 2
|
Danbooru.config.base_tag_query_limit * 2
|
||||||
|
|||||||
@@ -63,11 +63,12 @@ class UserPresenter
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_limit
|
def upload_limit(template)
|
||||||
if user.can_upload_free?
|
if user.can_upload_free?
|
||||||
return "none"
|
return "none"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
slots_tooltip = "Next free slot: #{template.time_ago_in_words(user.next_free_upload_slot)}"
|
||||||
limit_tooltip = <<-EOS.strip_heredoc
|
limit_tooltip = <<-EOS.strip_heredoc
|
||||||
Base: #{user.base_upload_limit}
|
Base: #{user.base_upload_limit}
|
||||||
Del. Rate: #{"%.2f" % user.adjusted_deletion_confidence}
|
Del. Rate: #{"%.2f" % user.adjusted_deletion_confidence}
|
||||||
@@ -75,7 +76,7 @@ class UserPresenter
|
|||||||
Upload Limit: #{user.base_upload_limit} * #{"%.2f" % user.upload_limit_multiplier} = #{user.max_upload_limit}
|
Upload Limit: #{user.base_upload_limit} * #{"%.2f" % user.upload_limit_multiplier} = #{user.max_upload_limit}
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
%{#{user.used_upload_slots} / <abbr title="#{limit_tooltip}">#{user.upload_limit}</abbr>}.html_safe
|
%{<abbr title="#{slots_tooltip}">#{user.used_upload_slots}</abbr> / <abbr title="#{limit_tooltip}">#{user.max_upload_limit}</abbr>}.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def uploads
|
def uploads
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Upload Limit</th>
|
<th>Upload Limit</th>
|
||||||
<td><%= presenter.upload_limit %> (<%= link_to "help", wiki_pages_path(title: "about:upload_limits") %>)</td>
|
<td><%= presenter.upload_limit(self) %> (<%= link_to "help", wiki_pages_path(title: "about:upload_limits") %>)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user