Merge branch 'master' into slot-username

This commit is contained in:
Belén Curcio
2017-08-21 12:27:00 -03:00
committed by GitHub
8 changed files with 29 additions and 19 deletions
+1 -13
View File
@@ -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;
@@ -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 ? (
<div className={styles.moderationLink}>
<a href={`/admin/moderate/${props.assetId}`} target="_blank">
<a href={`${BASE_PATH}admin/moderate/${props.assetId}`} target="_blank">
{t('moderate_this_stream')}
</a>
</div>
+1 -1
View File
@@ -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'
};
//==============================================================================
+1 -1
View File
@@ -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:
+3 -1
View File
@@ -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 = {
+1 -1
View File
@@ -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(';')
+19
View File
@@ -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,
};
+1 -1
View File
@@ -22,7 +22,7 @@
<main>
<h1><%= title %></h1>
<p><%= body %></p>
<p><a href="admin">Admin</a> - <a href="assets">All Assets</a></p>
<p><a href="<%= BASE_PATH %>admin">Admin</a> - <a href="<%= BASE_PATH %>assets">All Assets</a></p>
<div id='coralStreamEmbed'></div>
<script src="<%= BASE_URL %>embed.js" async onload="
window.TalkEmbed = Coral.Talk.render(document.getElementById('coralStreamEmbed'), {