From 3b83f5f80e2e3c20a0e50b5b804045f5c9b8a8c9 Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Sun, 13 May 2018 00:20:07 +0300 Subject: [PATCH] set useless mod for comments with score <= -10 --- web/app/common/constants.js | 2 ++ web/app/components/comment/comment.jsx | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/app/common/constants.js b/web/app/common/constants.js index 6a7c30b0..514873a3 100644 --- a/web/app/common/constants.js +++ b/web/app/common/constants.js @@ -7,6 +7,7 @@ const LAST_COMMENTS_NODE_CLASSNAME = 'remark42__last-comments'; const DEFAULT_LAST_COMMENTS_MAX = 15; const DEFAULT_MAX_COMMENT_SIZE = 1000; const DEFAULT_SORT = '-score'; +const USELESS_COMMENT_SCORE = -10; const PROVIDER_NAMES = { google: 'Google', facebook: 'Facebook', @@ -24,4 +25,5 @@ module.exports = { DEFAULT_MAX_COMMENT_SIZE, PROVIDER_NAMES, DEFAULT_SORT, + USELESS_COMMENT_SCORE, }; diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index fbdd5bda..dc96de43 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -1,7 +1,7 @@ import { h, Component } from 'preact'; import api from 'common/api'; -import { API_BASE, BASE_URL, COMMENT_NODE_CLASSNAME_PREFIX } from 'common/constants'; +import { API_BASE, BASE_URL, COMMENT_NODE_CLASSNAME_PREFIX, USELESS_COMMENT_SCORE } from 'common/constants'; import { url } from 'common/settings'; import store from 'common/store'; @@ -236,7 +236,7 @@ export default class Comment extends Component { const defaultMods = { pinned, - useless: userBlocked || deleted, + useless: userBlocked || deleted || (score <= USELESS_COMMENT_SCORE && !mods.pinned && !mods.disabled), // TODO: add default view mod or don't? view: o.user.admin ? 'admin' : null, replying: isInputVisible,