From fbac192d04323bd8496cba6f6d92b9bab0b0702b Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Sun, 25 Mar 2018 23:37:48 +0300 Subject: [PATCH] add comment status for admin; add comment placeholders only if text.length === 0 --- .../comment/__status/comment__status.scss | 4 +++ web/app/components/comment/comment.jsx | 28 +++++++++++++++---- web/app/components/comment/index.js | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 web/app/components/comment/__status/comment__status.scss diff --git a/web/app/components/comment/__status/comment__status.scss b/web/app/components/comment/__status/comment__status.scss new file mode 100644 index 00000000..ad8b164e --- /dev/null +++ b/web/app/components/comment/__status/comment__status.scss @@ -0,0 +1,4 @@ +.comment__status { + margin-left: 8px; + font-weight: 700; +} diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index a6d1a338..59e92f0a 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -176,12 +176,16 @@ export default class Comment extends Component { const o = { ...data, text: - userBlocked - ? 'This user was blocked' + data.text.length + ? (mods.view === 'preview' ? getTextSnippet(data.text) : data.text) : ( - deleted - ? 'This comment was deleted' - : (mods.view === 'preview' ? getTextSnippet(data.text) : data.text) + userBlocked + ? 'This user was blocked' + : ( + deleted + ? 'This comment was deleted' + : data.text + ) ), time: timeStr, score: { @@ -250,6 +254,20 @@ export default class Comment extends Component { ) } + { + isAdmin && data.text.length === 0 && defaultMods.useless && ( + + { + userBlocked && "blocked" + } + + { + !userBlocked && deleted && "deleted" + } + + ) + } + { !mods.disabled && !isGuest && ( diff --git a/web/app/components/comment/index.js b/web/app/components/comment/index.js index dafde925..d4720c93 100644 --- a/web/app/components/comment/index.js +++ b/web/app/components/comment/index.js @@ -11,6 +11,7 @@ require('./__input/comment__input.scss'); require('./__score/comment__score.scss'); require('./__score-sign/comment__score-sign.scss'); require('./__score-value/comment__score-value.scss'); +require('./__status/comment__status.scss'); require('./__text/comment__text.scss'); require('./__time/comment__time.scss'); require('./__username/comment__username.scss');