Disable report button on empty reason (#374)

Previously, people couldn't quite tell you needed to give a report
reason. Now we disable the submit button until there is a reason,
and flask.flash() if someone manages to submit an empty reason
anyway.
This commit is contained in:
Nicolas F
2017-10-04 02:03:22 +02:00
committed by Arylide
parent 0eea181020
commit 214952e7b6
2 changed files with 11 additions and 1 deletions

View File

@@ -376,6 +376,8 @@ def submit_report(torrent_id):
db.session.add(report)
db.session.commit()
flask.flash('Successfully reported torrent!', 'success')
elif len(form.reason.data) == 0:
flask.flash('Please give a report reason!', 'danger')
return flask.redirect(flask.url_for('torrents.view', torrent_id=torrent_id))