mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2025-01-26 06:45:13 +00:00
fix two bugs and a minor issue
This commit is contained in:
parent
60ce4ec3f1
commit
f1bab93a94
|
@ -203,6 +203,8 @@ def _delete_torrent(torrent, form, banform):
|
||||||
torrent.deleted = True
|
torrent.deleted = True
|
||||||
action = 'deleted and banned'
|
action = 'deleted and banned'
|
||||||
db.session.add(models.TrackerApi(torrent.info_hash, 'remove'))
|
db.session.add(models.TrackerApi(torrent.info_hash, 'remove'))
|
||||||
|
torrent.stats.seed_count = 0
|
||||||
|
torrent.stats.leech_count = 0
|
||||||
db.session.add(torrent)
|
db.session.add(torrent)
|
||||||
|
|
||||||
elif form.undelete.data and torrent.deleted:
|
elif form.undelete.data and torrent.deleted:
|
||||||
|
@ -354,7 +356,7 @@ def edit_comment(torrent_id, comment_id):
|
||||||
form = forms.CommentForm(flask.request.form)
|
form = forms.CommentForm(flask.request.form)
|
||||||
|
|
||||||
if not form.validate():
|
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))
|
flask.abort(flask.make_response(flask.jsonify({'error': error_str}), 400))
|
||||||
|
|
||||||
comment.text = form.comment.data
|
comment.text = form.comment.data
|
||||||
|
|
|
@ -171,6 +171,7 @@ def view_user(user_name):
|
||||||
rss_filter=rss_query_string,
|
rss_filter=rss_query_string,
|
||||||
admin_form=admin_form,
|
admin_form=admin_form,
|
||||||
ban_form=ban_form,
|
ban_form=ban_form,
|
||||||
|
nuke_form=nuke_form,
|
||||||
bans=bans,
|
bans=bans,
|
||||||
ipbanned=ipbanned)
|
ipbanned=ipbanned)
|
||||||
# Similar logic as home page
|
# 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):
|
for t in chain(user.nyaa_torrents, user.sukebei_torrents):
|
||||||
t.deleted = True
|
t.deleted = True
|
||||||
t.banned = True
|
t.banned = True
|
||||||
|
t.stats.seed_count = 0
|
||||||
|
t.stats.leech_count = 0
|
||||||
db.session.add(t)
|
db.session.add(t)
|
||||||
if isinstance(t, models.NyaaTorrent):
|
if isinstance(t, models.NyaaTorrent):
|
||||||
db.session.add(models.NyaaTrackerApi(t.info_hash, 'remove'))
|
db.session.add(models.NyaaTrackerApi(t.info_hash, 'remove'))
|
||||||
|
|
Loading…
Reference in a new issue