mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
post-reply soft-deletion: replace content in HTML with 'deleted by author/moderator'
This commit is contained in:
parent
a2a81e5726
commit
a2fae00936
3 changed files with 20 additions and 4 deletions
|
@ -11,7 +11,7 @@ from app.utils import blocked_instances, blocked_users
|
||||||
|
|
||||||
# replies to a post, in a tree, sorted by a variety of methods
|
# replies to a post, in a tree, sorted by a variety of methods
|
||||||
def post_replies(post_id: int, sort_by: str, show_first: int = 0) -> List[PostReply]:
|
def post_replies(post_id: int, sort_by: str, show_first: int = 0) -> List[PostReply]:
|
||||||
comments = PostReply.query.filter_by(post_id=post_id).filter(PostReply.deleted == False)
|
comments = PostReply.query.filter_by(post_id=post_id)
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
instance_ids = blocked_instances(current_user.id)
|
instance_ids = blocked_instances(current_user.id)
|
||||||
if instance_ids:
|
if instance_ids:
|
||||||
|
@ -52,7 +52,7 @@ def get_comment_branch(post_id: int, comment_id: int, sort_by: str) -> List[Post
|
||||||
if parent_comment is None:
|
if parent_comment is None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
comments = PostReply.query.filter(PostReply.post_id == post_id, PostReply.deleted == False)
|
comments = PostReply.query.filter(PostReply.post_id == post_id)
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
instance_ids = blocked_instances(current_user.id)
|
instance_ids = blocked_instances(current_user.id)
|
||||||
if instance_ids:
|
if instance_ids:
|
||||||
|
|
|
@ -28,7 +28,15 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="comment_body hidable {% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user) %}reported{% endif %}">
|
<div class="comment_body hidable {% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user) %}reported{% endif %}">
|
||||||
{{ comment['comment'].body_html | safe }}
|
{% if comment['comment'].deleted -%}
|
||||||
|
{% if comment['comment'].deleted_by is none or comment['comment'].deleted_by != comment['comment'].user_id -%}
|
||||||
|
<p>Deleted by moderator</p>
|
||||||
|
{% else -%}
|
||||||
|
<p>Deleted by author</p>
|
||||||
|
{% endif -%}
|
||||||
|
{% else -%}
|
||||||
|
{{ comment['comment'].body_html | community_links | safe }}
|
||||||
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="comment_actions hidable">
|
<div class="comment_actions hidable">
|
||||||
|
|
|
@ -91,7 +91,15 @@
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
<div class="comment_body hidable {% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user) -%}reported{% endif -%}">
|
<div class="comment_body hidable {% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user) -%}reported{% endif -%}">
|
||||||
|
{% if comment['comment'].deleted -%}
|
||||||
|
{% if comment['comment'].deleted_by is none or comment['comment'].deleted_by != comment['comment'].user_id -%}
|
||||||
|
<p>Deleted by moderator</p>
|
||||||
|
{% else -%}
|
||||||
|
<p>Deleted by author</p>
|
||||||
|
{% endif -%}
|
||||||
|
{% else -%}
|
||||||
{{ comment['comment'].body_html | community_links | safe }}
|
{{ comment['comment'].body_html | community_links | safe }}
|
||||||
|
{% endif -%}
|
||||||
</div>{% if not comment['comment'].author.indexable -%}<!--googleon: all-->{% endif -%}
|
</div>{% if not comment['comment'].author.indexable -%}<!--googleon: all-->{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
<div class="comment_actions hidable">
|
<div class="comment_actions hidable">
|
||||||
|
|
Loading…
Add table
Reference in a new issue