aurweb/templates/partials/packages/comment.html
moson 4821fc1312
fix: show placeholder for deleted user in comments
show "<deleted-account>" in comment headers in case a user
deleted their account.

Signed-off-by: moson <moson@archlinux.org>
2023-07-08 13:44:24 +02:00

49 lines
1.7 KiB
HTML

{% set header_cls = "comment-header" %}
{% set article_cls = "article-content" %}
{% set comment_by = comment.User.Username %}
{% if not comment.User %}
{% set comment_by = "&lt;deleted-account&gt;" %}
{% endif %}
{% if comment.Deleter %}
{% set header_cls = "%s %s" | format(header_cls, "comment-deleted") %}
{% set article_cls = "%s %s" | format(article_cls, "comment-deleted") %}
{% 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_by) %}
{{
"%s commented on %s" | tr | format(
('<a href="/account/%s" title="%s">%s</a>' | format(
comment_by,
view_account_info,
comment_by
)) if request.user.is_authenticated() and comment.User else
(comment_by),
'<a href="#comment-%s" class="date">%s</a>' | format(
comment.ID,
datetime_display(comment.CommentTS)
)
)
| safe
}}
{% if comment.Editor %}
{% set edited_on = comment.EditedTS | dt | as_timezone(timezone) %}
<span class="edited">
({{ "edited on %s by %s" | tr
| format(datetime_display(comment.EditedTS),
'<a href="/account/%s">%s</a>' | format(
comment.Editor.Username, comment.Editor.Username))
| safe
}})
</span>
{% endif %}
{% include "partials/comment_actions.html" %}
</h4>
{% include "partials/comment_content.html" %}
{% endif %}
{% endif %}