feat: allow users to hide deleted comments

Closes: #435

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
Leonidas Spyropoulos 2023-04-21 19:47:55 +01:00
parent 174af5f025
commit 6ede837b4f
No known key found for this signature in database
GPG key ID: 59E43E106B247368
9 changed files with 132 additions and 5 deletions

View file

@ -4,7 +4,7 @@
{% endif %}
{% if not comment.Deleter or request.user.has_credential(creds.COMMENT_VIEW_DELETED, approved=[comment.Deleter]) %}
{% if not (request.user.HideDeletedComments and comment.DelTS) %}
{% set commented_at = comment.CommentTS | dt | as_timezone(timezone) %}
<h4 id="comment-{{ comment.ID }}" class="{{ header_cls }}">
{{
@ -38,3 +38,4 @@
{% include "partials/comment_content.html" %}
{% endif %}
{% endif %}

View file

@ -182,7 +182,7 @@
maxlength="50" name="K" value="{{ pgp }}">
</p>
<!-- Homepage -->
<!-- Language -->
<p>
<label for="id_language">
{% trans %}Language{% endtrans %}:
@ -202,10 +202,10 @@
</select>
</p>
<!-- Homepage -->
<!-- Timezone -->
<p>
<label for="id_timezone">
{% trans %}Timezone{% endtrans %}
{% trans %}Timezone{% endtrans %}:
</label>
<select id="id_timezone" name="TZ">
@ -219,6 +219,19 @@
</select>
</p>
<!-- Hide Deleted Comments -->
<p>
<label for="id_hidedeletedcomments">
{% trans %}Hide deleted comments{% endtrans %}:
</label>
<input id="id_hidedeletedcomments" type="checkbox" name="HDC"
{% if hdc %}
checked="checked"
{% endif %}
>
</p>
</fieldset>
{% if form_type == "UpdateAccount" %}

View file

@ -6,6 +6,7 @@
{% endif %}
{% if not comment.Deleter or request.user.has_credential(creds.COMMENT_VIEW_DELETED, approved=[comment.Deleter]) %}
{% if not (request.user.HideDeletedComments and comment.DelTS) %}
<h4 id="comment-{{ comment.ID }}" class="{{ header_cls }}">
{% set commented_at = comment.CommentTS | dt | as_timezone(timezone) %}
{% set view_account_info = 'View account information for %s' | tr | format(comment.User.Username) %}
@ -41,3 +42,4 @@
{% include "partials/comment_content.html" %}
{% endif %}
{% endif %}