Skip to content

Commit

Permalink
Commit editing time
Browse files Browse the repository at this point in the history
  • Loading branch information
Arylide committed Apr 2, 2018
1 parent f1bab93 commit 03094b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nyaa/templates/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ <h3 class="panel-title">
{% if g.user.id == comment.user_id and not comment.editing_limit_exceeded and (not torrent.comment_locked or comment_form) %}
<button class="btn btn-xs edit-comment" title="Edit"{% if config.EDITING_TIME_LIMIT %} data-until="{{ comment.editable_until|int }}"{% endif %}>Edit</button>
{% endif %}
{% if g.user.is_superadmin or (g.user.id == comment.user_id and not torrent.comment_locked) %}
{% if g.user.is_superadmin or (g.user.id == comment.user_id and not torrent.comment_locked and not comment.editing_limit_exceeded) %}
<form class="delete-comment-form" action="{{ url_for('torrents.delete_comment', torrent_id=torrent.id, comment_id=comment.id) }}" method="POST">
<button name="submit" type="submit" class="btn btn-danger btn-xs" title="Delete">Delete</button>
</form>
Expand Down
3 changes: 3 additions & 0 deletions nyaa/views/torrents.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ def delete_comment(torrent_id, comment_id):
if torrent.comment_locked and not flask.g.user.is_moderator:
flask.abort(403)

if comment.editing_limit_exceeded and not flask.g.user.is_superadmin:
flask.abort(403)

db.session.delete(comment)
db.session.flush()
torrent.update_comment_count()
Expand Down

0 comments on commit 03094b6

Please sign in to comment.