From 3103cab4c6e2f86add9bb423a40794793e400f20 Mon Sep 17 00:00:00 2001 From: Daniel Aleksandersen Date: Sun, 5 Dec 2021 17:54:36 +0100 Subject: [PATCH 1/2] Add `hashover-status-$status` to comment wrapper --- backend/classes/commentsui.php | 6 ++++-- backend/classes/phpmode.php | 5 ++++- frontend/parsecomment.js | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/classes/commentsui.php b/backend/classes/commentsui.php index 817abe7e..99ac7a96 100644 --- a/backend/classes/commentsui.php +++ b/backend/classes/commentsui.php @@ -20,11 +20,13 @@ class CommentsUI extends FormUI { // Creates a wrapper element for each comment - public function commentWrapper ($permalink = '{permalink}') + public function commentWrapper ($permalink = '{permalink}', $status = '{status}') { + $status_class = (! empty($status)) ? " hashover-status-${status}" : ''; + $comment_wrapper = new HTMLTag ('div', array ( 'id' => $this->prefix ($permalink), - 'class' => 'hashover-comment' + 'class' => 'hashover-comment' . $status_class ), false); if ($this->mode !== 'php') { diff --git a/backend/classes/phpmode.php b/backend/classes/phpmode.php index 7665075f..d69f1b5b 100644 --- a/backend/classes/phpmode.php +++ b/backend/classes/phpmode.php @@ -215,8 +215,11 @@ public function parseComment (array $comment, $parent = null, $popular = false) $permatext = explode ('r', $permatext); $permatext = array_pop ($permatext); + // Post moderation status + $status = isset ($comment['status']) ? $comment['status'] : null; + // Wrapper element for each comment - $comment_wrapper = $this->ui->commentWrapper ($permalink); + $comment_wrapper = $this->ui->commentWrapper ($permalink, $comment['status']); // Check if this comment is a popular comment if ($popular === true) { diff --git a/frontend/parsecomment.js b/frontend/parsecomment.js index ff4aca3e..20857158 100644 --- a/frontend/parsecomment.js +++ b/frontend/parsecomment.js @@ -429,6 +429,11 @@ HashOverConstructor.prototype.parseComment = function (comment, parent, collapse } } + // Append status class + if (comment['status']) { + classes += ` hashover-status-${comment['status']}`; + } + // Wrap comment HTML var wrapper = this.strings.parseTemplate ( this.ui['comment-wrapper'], { From 1c49c12c4c2e43f866406844d2a44678d71eca62 Mon Sep 17 00:00:00 2001 From: Daniel Aleksandersen Date: Sun, 5 Dec 2021 17:55:17 +0100 Subject: [PATCH 2/2] Make pending comments easier to see For admin, set the .hashover-header background-color to striped pink-ish red and blue. --- themes/default/comments.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/themes/default/comments.css b/themes/default/comments.css index 3f6b1310..5c7ab9d6 100644 --- a/themes/default/comments.css +++ b/themes/default/comments.css @@ -649,6 +649,15 @@ conditions, unless such conditions are required by law. /*background-color: #FFE5F0;*/ } +.hashover .hashover-comment.hashover-status-pending > .hashover-header { + /* Light red (pink-ish) */ + background-color: #FFE5F0; + + /* Sriped light red (pink-ish) and light blue */ + background-image: linear-gradient(45deg, #FFE5F0 25%, #E5F0FF 25%, #E5F0FF 50%, #FFE5F0 50%, #FFE5F0 75%, #E5F0FF 75%, # E5F0FF 100%); + background-size: 50px 50px; +} + .hashover .hashover-avatar-image *, .hashover .hashover-avatar *, .hashover .hashover-reply .hashover-header,