1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 04:00:01 +00:00

Fix banning torrents without uploader ip

Pretty much just for archived torrents
This commit is contained in:
Anna-Maria Meriniemi 2017-08-26 02:52:59 +03:00 committed by GitHub
parent aa3c2ba77b
commit 4eed4971a3

View file

@ -157,11 +157,16 @@ def edit_torrent(torrent_id):
ipbanned = None
if editor.is_moderator:
tbanned = models.Ban.banned(None, torrent.uploader_ip).first()
ubanned = True
torrent_ip_banned = True
user_ip_banned = True
# Archived torrents do not have a null uploader_ip
if torrent.uploader_ip:
torrent_ip_banned = models.Ban.banned(None, torrent.uploader_ip).first()
if torrent.user:
ubanned = models.Ban.banned(None, torrent.user.last_login_ip).first()
ipbanned = (tbanned and ubanned)
user_ip_banned = models.Ban.banned(None, torrent.user.last_login_ip).first()
ipbanned = (torrent_ip_banned and user_ip_banned)
return flask.render_template('edit.html',
form=form,