diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html
index cb80e63..ae792d4 100644
--- a/nyaa/templates/view.html
+++ b/nyaa/templates/view.html
@@ -200,7 +200,7 @@
{{ render_field(report_form.reason, class_='form-control', maxlength=255) }}
-
+
@@ -214,6 +214,14 @@
// Focus the report text field once the modal is opened.
$('#reportModal').on('shown.bs.modal', function () {
$('#reason').focus();
+ $('#reportSubmit').attr('disabled', true);
+ });
+ $('#reason').on('input', function(e) {
+ if($('#reason').val().length > 0) {
+ $('#reportSubmit').removeAttr('disabled');
+ } else {
+ $('#reportSubmit').attr('disabled', true);
+ }
});
{% endif %}
diff --git a/nyaa/views/torrents.py b/nyaa/views/torrents.py
index 3f1a34b..fd14bcb 100644
--- a/nyaa/views/torrents.py
+++ b/nyaa/views/torrents.py
@@ -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))