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()