<%= title %>
<%= body %>
- +diff --git a/app.js b/app.js index 9abb921ae..741dac93f 100644 --- a/app.js +++ b/app.js @@ -5,10 +5,9 @@ const path = require('path'); const helmet = require('helmet'); const compression = require('compression'); const cookieParser = require('cookie-parser'); -const {ROOT_URL, ROOT_URL_MOUNT_PATH} = require('./config'); +const {BASE_URL, BASE_PATH, MOUNT_PATH} = require('./url'); const routes = require('./routes'); const debug = require('debug')('talk:app'); -const {URL} = require('url'); const app = express(); @@ -51,17 +50,6 @@ app.set('view engine', 'ejs'); // ROUTES //============================================================================== -// Set the BASE_URL as the ROOT_URL, here we derive the root url by ensuring -// that it ends in a `/`. -const BASE_URL = ROOT_URL && ROOT_URL.length > 0 && ROOT_URL[ROOT_URL.length - 1] === '/' ? ROOT_URL : `${ROOT_URL}/`; - -// The BASE_PATH is simply the path component of the BASE_URL. -const BASE_PATH = new URL(BASE_URL).pathname; - -// The MOUNT_PATH is derived from the BASE_PATH, if it is provided and enabled. -// This will mount all the application routes onto it. -const MOUNT_PATH = ROOT_URL_MOUNT_PATH ? BASE_PATH : '/'; - // Apply the BASE_PATH, BASE_URL, and MOUNT_PATH on the app.locals, which will // make them available on the templates and the routers. app.locals.BASE_URL = BASE_URL; diff --git a/client/talk-plugin-moderation/ModerationLink.js b/client/talk-plugin-moderation/ModerationLink.js index 020b8c345..1a10160ee 100644 --- a/client/talk-plugin-moderation/ModerationLink.js +++ b/client/talk-plugin-moderation/ModerationLink.js @@ -2,10 +2,11 @@ import React, {PropTypes} from 'react'; import styles from './styles.css'; import t from 'coral-framework/services/i18n'; +import {BASE_PATH} from 'coral-framework/constants/url'; const ModerationLink = (props) => props.isAdmin ? (
diff --git a/config.js b/config.js index 22720a36a..11c8b5077 100644 --- a/config.js +++ b/config.js @@ -153,7 +153,7 @@ const CONFIG = { DISABLE_AUTOFLAG_SUSPECT_WORDS: process.env.TALK_DISABLE_AUTOFLAG_SUSPECT_WORDS === 'TRUE', // TRUST_THRESHOLDS defines the thresholds used for automoderation. - TRUST_THRESHOLDS: process.env.TRUST_THRESHOLDS || 'comment:-1,-1;flag:-1,-1' + TRUST_THRESHOLDS: process.env.TRUST_THRESHOLDS || 'comment:2,-1;flag:2,-1' }; //============================================================================== diff --git a/docs/_docs/02-01-configuration.md b/docs/_docs/02-01-configuration.md index 58c828f9a..df790b24b 100644 --- a/docs/_docs/02-01-configuration.md +++ b/docs/_docs/02-01-configuration.md @@ -177,7 +177,7 @@ Trust can auto-moderate comments based on user history. By specifying this option, the behavior can be changed to offer different results. - `TRUST_THRESHOLDS` (_optional_) - configure the reliability thresholds for - flagging and commenting. (Default `comment:-1,-1;flag:-1,-1`) + flagging and commenting. (Default `comment:2,-1;flag:2,-1`) The form of the environment variable: diff --git a/graph/subscriptions.js b/graph/subscriptions.js index f89b41d3a..71b8abc6a 100644 --- a/graph/subscriptions.js +++ b/graph/subscriptions.js @@ -26,6 +26,8 @@ const { SUBSCRIBE_ALL_USERNAME_REJECTED, } = require('../perms/constants'); +const {BASE_PATH} = require('../url'); + /** * Plugin support requires that we merge in existing setupFunctions with our new * plugin based ones. This allows plugins to extend existing setupFunctions as well @@ -170,7 +172,7 @@ const createSubscriptionManager = (server) => new SubscriptionServer({ keepAlive: ms(KEEP_ALIVE) }, { server, - path: '/api/v1/live' + path: `${BASE_PATH}api/v1/live` }); module.exports = { diff --git a/services/karma.js b/services/karma.js index a2c087eaa..687b67af0 100644 --- a/services/karma.js +++ b/services/karma.js @@ -19,7 +19,7 @@ const { * * The default used is: * - * comment:-1,-1;flag:-1,-1 + * comment:2,-2;flag:2,-2 */ const parseThresholds = (thresholds) => thresholds .split(';') diff --git a/url.js b/url.js new file mode 100644 index 000000000..1def7a707 --- /dev/null +++ b/url.js @@ -0,0 +1,19 @@ +const {ROOT_URL, ROOT_URL_MOUNT_PATH} = require('./config'); +const {URL} = require('url'); + +// Set the BASE_URL as the ROOT_URL, here we derive the root url by ensuring +// that it ends in a `/`. +const BASE_URL = ROOT_URL && ROOT_URL.length > 0 && ROOT_URL[ROOT_URL.length - 1] === '/' ? ROOT_URL : `${ROOT_URL}/`; + +// The BASE_PATH is simply the path component of the BASE_URL. +const BASE_PATH = new URL(BASE_URL).pathname; + +// The MOUNT_PATH is derived from the BASE_PATH, if it is provided and enabled. +// This will mount all the application routes onto it. +const MOUNT_PATH = ROOT_URL_MOUNT_PATH ? BASE_PATH : '/'; + +module.exports = { + BASE_URL: BASE_URL, + BASE_PATH: BASE_PATH, + MOUNT_PATH: MOUNT_PATH, +}; diff --git a/views/article.ejs b/views/article.ejs index f0a3dad98..0f8c75594 100644 --- a/views/article.ejs +++ b/views/article.ejs @@ -22,7 +22,7 @@<%= body %>
- +