mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 15:10:01 +00:00
Scroll user to their new comment after submission
This commit is contained in:
parent
1ab3d6e3eb
commit
bb30f6e3d2
|
@ -655,9 +655,11 @@ def view_torrent(torrent_id):
|
||||||
db.session.add(comment)
|
db.session.add(comment)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
torrent_count = models.Comment.query.filter_by(torrent_id=torrent.id).count()
|
||||||
|
|
||||||
flask.flash('Comment successfully posted.', 'success')
|
flask.flash('Comment successfully posted.', 'success')
|
||||||
|
|
||||||
return flask.redirect(flask.url_for('view_torrent', torrent_id=torrent_id))
|
return flask.redirect(flask.url_for('view_torrent', torrent_id=torrent_id, _anchor='com-'+str(torrent_count)))
|
||||||
|
|
||||||
# Only allow owners and admins to edit torrents
|
# Only allow owners and admins to edit torrents
|
||||||
can_edit = flask.g.user and (flask.g.user is torrent.user or flask.g.user.is_moderator)
|
can_edit = flask.g.user and (flask.g.user is torrent.user or flask.g.user.is_moderator)
|
||||||
|
|
Loading…
Reference in a new issue