upload limits: add time remaining until next upload to profiles (fix #3262).

This commit is contained in:
evazion
2017-08-10 23:52:47 -05:00
parent bf3101da48
commit 1ef363dd68
3 changed files with 8 additions and 3 deletions

View File

@@ -585,6 +585,10 @@ class User < ApplicationRecord
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
if is_platinum?
Danbooru.config.base_tag_query_limit * 2

View File

@@ -63,11 +63,12 @@ class UserPresenter
end
end
def upload_limit
def upload_limit(template)
if user.can_upload_free?
return "none"
end
slots_tooltip = "Next free slot: #{template.time_ago_in_words(user.next_free_upload_slot)}"
limit_tooltip = <<-EOS.strip_heredoc
Base: #{user.base_upload_limit}
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}
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
def uploads

View File

@@ -31,7 +31,7 @@
<tr>
<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>