From aa3c2ba77b3490e654c4df5c854649d72c2ed383 Mon Sep 17 00:00:00 2001 From: Anna-Maria Meriniemi Date: Sat, 26 Aug 2017 02:36:38 +0300 Subject: [PATCH] Fix banning anonymous torrents We miss ye, testing --- nyaa/views/torrents.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nyaa/views/torrents.py b/nyaa/views/torrents.py index 9fec0c0..65f92f1 100644 --- a/nyaa/views/torrents.py +++ b/nyaa/views/torrents.py @@ -98,7 +98,8 @@ def edit_torrent(torrent_id): if not editor or not (editor is torrent.user or editor.is_moderator): flask.abort(403) - if editor and editor.is_moderator and editor.level > torrent.user.level: + torrent_user_level = torrent.user and torrent.user.level + if editor and editor.is_moderator and (torrent_user_level is None or editor.level > torrent_user_level): ban_form = forms.BanForm() if flask.request.method == 'POST' and form.submit.data and form.validate():