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

Remove duplicate reports for already reviewed torrent

This commit is contained in:
nyaazi 2017-05-20 13:58:58 +03:00
parent 354736720b
commit 73c84ce5ec
3 changed files with 6 additions and 1 deletions

View file

@ -429,6 +429,10 @@ class Report(db.Model):
# reports = cls.query.filter_by(status=0).paginate(page=page, per_page=20)
return reports
@classmethod
def remove_reviewed(cls, id):
return cls.query.filter(cls.torrent_id == id, cls.status == 0).delete()
# class Session(db.Model):
# __tablename__ = 'sessions'
#

View file

@ -710,6 +710,7 @@ def view_reports():
else:
report.status = 2
models.Report.remove_reviewed(data['torrent'])
db.session.commit()
flask.flash('Closed report #{}'.format(report.id), 'success')
return flask.redirect(flask.url_for('view_reports'))

View file

@ -62,7 +62,7 @@
soon{% endif %}</div>
</div>
</div>
<div class="panel-footer">
<div class="panel-footer" style="font-size: large">
{% if torrent.has_torrent %}
<a href="/view/{{ torrent.id }}/torrent"><i class="fa fa-download fa-fw"></i>Download Torrent</a>
or {% endif %}<a href="{{ torrent.magnet_uri }}" class="card-footer-item"><i