Commit editing time

This commit is contained in:
Arylide 2018-04-02 13:18:39 -07:00
parent f1bab93a94
commit 03094b6d36
2 changed files with 4 additions and 1 deletions

View File

@ -162,7 +162,7 @@
{% 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>

View File

@ -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()