site admins can delete comments

This commit is contained in:
rimu 2024-04-15 12:16:29 +12:00
parent b193f71527
commit 3c006332e3
2 changed files with 2 additions and 2 deletions

View file

@ -1442,7 +1442,7 @@ def post_reply_delete(post_id: int, comment_id: int):
post = Post.query.get_or_404(post_id)
post_reply = PostReply.query.get_or_404(comment_id)
community = post.community
if post_reply.user_id == current_user.id or community.is_moderator():
if post_reply.user_id == current_user.id or community.is_moderator() or current_user.is_admin():
if post_reply.has_replies():
post_reply.body = 'Deleted by author' if post_reply.author.id == current_user.id else 'Deleted by moderator'
post_reply.body_html = markdown_to_html(post_reply.body)

View file

@ -13,7 +13,7 @@
<div class="card-title">{{ _('Options for comment on "%(post_title)s"', post_title=post.title) }}</div>
<ul class="option_list">
{% if current_user.is_authenticated %}
{% if post_reply.user_id == current_user.id or post.community.is_moderator() %}
{% if post_reply.user_id == current_user.id or post.community.is_moderator() or current_user.is_admin() %}
<li><a href="{{ url_for('post.post_reply_edit', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-edit"></span>
{{ _('Edit') }}</a></li>
<li><a href="{{ url_for('post.post_reply_delete', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>