diff --git a/templates/partials/packages/comment.html b/templates/partials/packages/comment.html index 36696215..6af5cd9e 100644 --- a/templates/partials/packages/comment.html +++ b/templates/partials/packages/comment.html @@ -1,60 +1,90 @@ -

- {% set commented_at = comment.CommentTS | dt | as_timezone(timezone) %} - {% set view_account_info = 'View account information for %s' | tr | format(comment.User.Username) %} - {{ - "%s commented on %s" | tr | format( - ('%s' | format( - comment.User.Username, - view_account_info, - comment.User.Username - )) if request.user.is_authenticated() else - (comment.User.Username), - '%s' | format( - comment.ID, - commented_at.strftime("%Y-%m-%d %H:%M") - ) - ) - | safe - }} - {% if comment.Editor %} - {% set edited_on = comment.EditedTS | dt | as_timezone(timezone) %} - - ({{ "edited on %s by %s" | tr - | format(edited_on.strftime('%Y-%m-%d %H:%M'), - '%s' | format( - comment.Editor.Username, comment.Editor.Username)) - | safe - }}) - - {% endif %} - {% if request.user.is_elevated() or pkgbase.Maintainer == request.user %} -
-
- - - - -
-
- Edit comment +{% set header_cls = "comment-header" %} +{% set article_cls = "article-content" %} +{% if comment.Deleter %} + {% set header_cls = "%s %s" | format(header_cls, "comment-deleted") %} + {% set article_cls = "%s %s" | format(article_cls, "comment-deleted") %} +{% endif %} -
-
- - - - - -
-
- {% endif %} -

-
-
- {% if comment.RenderedComment %} - {{ comment.RenderedComment | safe }} - {% else %} - {{ comment.Comments }} - {% endif %} -
-
+{% if not comment.Deleter or request.user.has_credential("CRED_COMMENT_VIEW_DELETED", approved=[comment.Deleter]) %} +

+ {% set commented_at = comment.CommentTS | dt | as_timezone(timezone) %} + {% set view_account_info = 'View account information for %s' | tr | format(comment.User.Username) %} + {{ + "%s commented on %s" | tr | format( + ('%s' | format( + comment.User.Username, + view_account_info, + comment.User.Username + )) if request.user.is_authenticated() else + (comment.User.Username), + '%s' | format( + comment.ID, + commented_at.strftime("%Y-%m-%d %H:%M") + ) + ) + | safe + }} + {% if comment.Editor %} + {% set edited_on = comment.EditedTS | dt | as_timezone(timezone) %} + + ({{ "edited on %s by %s" | tr + | format(edited_on.strftime('%Y-%m-%d %H:%M'), + '%s' | format( + comment.Editor.Username, comment.Editor.Username)) + | safe + }}) + + {% endif %} + {% if not comment.Deleter %} + {% if request.user.has_credential('CRED_COMMENT_DELETE', approved=[comment.User]) %} +
+
+ +
+
+ {% endif %} + + {% if request.user.has_credential('CRED_COMMENT_EDIT', approved=[comment.User]) %} + Edit comment + {% endif %} + + {% if request.user.has_credential("CRED_COMMENT_PIN", approved=[pkgbase.Maintainer]) %} +
+
+ + + + + +
+
+ {% endif %} + {% else %} + {% if request.user.has_credential("CRED_COMMENT_UNDELETE", approved=[comment.User]) %} +
+
+ +
+
+ {% endif %} + {% endif %} +

+
+
+ {% if comment.RenderedComment %} + {{ comment.RenderedComment | safe }} + {% else %} + {{ comment.Comments }} + {% endif %} +
+
+{% endif %}