if is_trusted is not sent and user is trusted, torrent will marked as trusted unless specified. this also enable backward compat of v1

This commit is contained in:
aldacron 2017-05-21 22:53:28 -07:00
parent c2438f3913
commit 8fc81b395e
2 changed files with 9 additions and 2 deletions

View File

@ -72,7 +72,14 @@ def handle_torrent_upload(upload_form, uploading_user=None, fromAPI=False):
torrent.complete = upload_form.is_complete.data
# Copy trusted status from user if possible
can_mark_trusted = uploading_user and uploading_user.is_trusted
torrent.trusted = upload_form.is_trusted.data if can_mark_trusted else False
# Automatically mark trusted if user is trusted unless user specifies it to not be trusted
if can_mark_trusted:
torrent.trusted = True
if upload_form.is_trusted.data is False:
torrent.trusted = False
else:
torrent.trusted = False
# Set category ids
torrent.main_category_id, torrent.sub_category_id = \
upload_form.category.parsed_data.get_category_ids()

View File

@ -3,7 +3,7 @@
{% block body %}
<div class="alert alert-info">
<p><strong>5/18 Update:</strong> We've added an upload api for ease of uploading. See documentation <a href="https://github.com/nyaadevs/nyaa/blob/master/utils/api_uploader.py">here</a>.</p>
<p><strong>5/21 Update:</strong> We've updated our upload API to v2 (v1 still works). See documentation <b><a href="https://github.com/nyaadevs/nyaa/blob/master/utils/api_uploader_v2.py">here</a></b>.</p>
<p><strong>5/17 Update:</strong> We've added faster and more accurate search! In addition to your typical keyword search in both English and other languages, you can also now use powerful operators
like <kbd>clockwork planet -horrible</kbd> or <kbd>commie|horrible|cartel yowamushi</kbd> to search. For all supported operators, please click <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html#_simple_query_string_syntax">here</a>. More features are coming soon!</p><br>
<p>We welcome you to provide feedback at <a href="irc://irc.rizon.net/nyaa-dev">#nyaa-dev@irc.rizon.net</a></p>