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,