mirror of
https://github.com/sb745/NyaaV3.git
synced 2025-03-12 13:56:55 +02:00
Don't submit reports for already banned torrents (#448)
If users kept their page open for a while before reporting a torrent, and mods got it in the meantime, users could still submit reports for that torrent. This is silly and really doesn't need to happen.
This commit is contained in:
parent
658eefe42a
commit
7bef642f4e
1 changed files with 6 additions and 0 deletions
|
@ -400,6 +400,12 @@ def submit_report(torrent_id):
|
|||
flask.abort(403)
|
||||
|
||||
form = forms.ReportForm(flask.request.form)
|
||||
torrent = models.Torrent.by_id(torrent_id)
|
||||
if not torrent:
|
||||
flask.abort(404)
|
||||
if torrent.banned:
|
||||
flask.flash("The torrent you've tried to report is already banned.", 'danger')
|
||||
flask.abort(404)
|
||||
|
||||
if flask.request.method == 'POST' and form.validate():
|
||||
report_reason = form.reason.data
|
||||
|
|
Loading…
Add table
Reference in a new issue