diff --git a/web/app/common/constants.js b/web/app/common/constants.js index 514873a3..6a7c30b0 100644 --- a/web/app/common/constants.js +++ b/web/app/common/constants.js @@ -7,7 +7,6 @@ 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', @@ -25,5 +24,4 @@ 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 b7b56dab..31b6683b 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, USELESS_COMMENT_SCORE } from 'common/constants'; +import { API_BASE, BASE_URL, COMMENT_NODE_CLASSNAME_PREFIX } from 'common/constants'; import { url } from 'common/settings'; import store from 'common/store'; @@ -233,6 +233,7 @@ export default class Comment extends Component { const isAdmin = !guest && store.get('user').admin; const isGuest = guest || !Object.keys(store.get('user')).length; const isCurrentUser = (data.user && data.user.id) === (store.get('user') && store.get('user').id); + const criticalCommentScore = store.get('config') && store.get('config').critical_score; const o = { ...data, @@ -263,7 +264,8 @@ export default class Comment extends Component { const defaultMods = { pinned, - useless: userBlocked || deleted || (score <= USELESS_COMMENT_SCORE && !mods.pinned && !mods.disabled), + // TODO: we also have low_score, so we need to collapse comments on critical score in future + useless: userBlocked || deleted || (score <= criticalCommentScore && !mods.pinned && !mods.disabled), // TODO: add default view mod or don't? view: o.user.admin ? 'admin' : null, replying: isReplying,