fix two bugs and a minor issue

This commit is contained in:
nyaadev 2018-04-02 22:06:41 +02:00
parent 60ce4ec3f1
commit f1bab93a94
2 changed files with 6 additions and 1 deletions

View File

@ -203,6 +203,8 @@ def _delete_torrent(torrent, form, banform):
torrent.deleted = True
action = 'deleted and banned'
db.session.add(models.TrackerApi(torrent.info_hash, 'remove'))
torrent.stats.seed_count = 0
torrent.stats.leech_count = 0
db.session.add(torrent)
elif form.undelete.data and torrent.deleted:
@ -354,7 +356,7 @@ def edit_comment(torrent_id, comment_id):
form = forms.CommentForm(flask.request.form)
if not form.validate():
error_str = ' '.join(form.errors['comment'])
error_str = ' '.join(form.errors)
flask.abort(flask.make_response(flask.jsonify({'error': error_str}), 400))
comment.text = form.comment.data

View File

@ -171,6 +171,7 @@ def view_user(user_name):
rss_filter=rss_query_string,
admin_form=admin_form,
ban_form=ban_form,
nuke_form=nuke_form,
bans=bans,
ipbanned=ipbanned)
# Similar logic as home page
@ -270,6 +271,8 @@ def nuke_user_torrents(user_name):
for t in chain(user.nyaa_torrents, user.sukebei_torrents):
t.deleted = True
t.banned = True
t.stats.seed_count = 0
t.stats.leech_count = 0
db.session.add(t)
if isinstance(t, models.NyaaTorrent):
db.session.add(models.NyaaTrackerApi(t.info_hash, 'remove'))