diff --git a/templates/account/comments.html b/templates/account/comments.html index 4a516dca..95585180 100644 --- a/templates/account/comments.html +++ b/templates/account/comments.html @@ -18,46 +18,7 @@ {% for comment in comments %} - {% set header_cls = "comment-header" %} - {% if comment.Deleter %} - {% set header_cls = "%s %s" | format(header_cls, "comment-deleted") %} - {% 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) %} -

- {{ - "Commented on package %s%s%s on %s%s%s" | tr - | format( - '' | format(comment.PackageBase.Name), - comment.PackageBase.Name, - "", - '' | format( - username, - 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 %} - - {% include "partials/comment_actions.html" %} -

- - {% include "partials/comment_content.html" %} - {% endif %} + {% include "partials/account/comment.html" %} {% endfor %} diff --git a/templates/partials/account/comment.html b/templates/partials/account/comment.html new file mode 100644 index 00000000..bc167cf7 --- /dev/null +++ b/templates/partials/account/comment.html @@ -0,0 +1,40 @@ +{% set header_cls = "comment-header" %} +{% if comment.Deleter %} + {% set header_cls = "%s %s" | format(header_cls, "comment-deleted") %} +{% 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) %} +

+ {{ + "Commented on package %s%s%s on %s%s%s" | tr + | format( + '' | format(comment.PackageBase.Name), + comment.PackageBase.Name, + "", + '' | format( + username, + 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 %} + + {% include "partials/comment_actions.html" %} +

+ + {% include "partials/comment_content.html" %} +{% endif %}