set useless mod for comments with score <= -10

This commit is contained in:
igoradamenko
2018-05-13 00:20:07 +03:00
parent c8e5b1871f
commit 3b83f5f80e
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -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,
};
+2 -2
View File
@@ -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,