diff --git a/app.js b/app.js index 4e74062d5..9da2041fc 100644 --- a/app.js +++ b/app.js @@ -2,6 +2,7 @@ const express = require('express'); const bodyParser = require('body-parser'); const morgan = require('morgan'); const path = require('path'); +const merge = require('lodash/merge'); const helmet = require('helmet'); const compression = require('compression'); const cookieParser = require('cookie-parser'); @@ -10,6 +11,7 @@ const { BASE_PATH, MOUNT_PATH, STATIC_URL, + HELMET_CONFIGURATION, } = require('./url'); const routes = require('./routes'); const debug = require('debug')('talk:app'); @@ -31,9 +33,9 @@ app.set('trust proxy', 1); // Enable a suite of security good practices through helmet. We disable // frameguard to allow crossdomain injection of the embed. -app.use(helmet({ +app.use(helmet(merge(HELMET_CONFIGURATION, { frameguard: false, -})); +}))); // Compress the responses if appropriate. app.use(compression()); diff --git a/client/coral-admin/src/components/CommentLabels.css b/client/coral-admin/src/components/CommentLabels.css new file mode 100644 index 000000000..b7a5699fe --- /dev/null +++ b/client/coral-admin/src/components/CommentLabels.css @@ -0,0 +1,27 @@ +.root { + display: flex; + justify-content: flex-end; +} + +.coreLabels { + > *:not(:last-child) { + margin-right: 3px; + } +} + +.slot { + &:not(:empty) { + padding-left: 3px; + } + > *:not(:last-child) { + margin-right: 3px; + } +} + +.replyLabel { + background-color: #3D73D5; +} + +.premodLabel { + background-color: #063B9A; +} diff --git a/client/coral-admin/src/components/CommentLabels.js b/client/coral-admin/src/components/CommentLabels.js new file mode 100644 index 000000000..7af7e9a7e --- /dev/null +++ b/client/coral-admin/src/components/CommentLabels.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Label from 'coral-ui/components/Label'; +import Slot from 'coral-framework/components/Slot'; +import FlagLabel from 'coral-ui/components/FlagLabel'; +import cn from 'classnames'; +import styles from './CommentLabels.css'; + +function isUserFlagged(actions) { + return actions.some((action) => action.__typename === 'FlagAction' && action.user); +} + +function hasSuspectedWords(actions) { + return actions.some((action) => action.__typename === 'FlagAction' && action.reason === 'Matched suspect word filter'); +} + +function hasHistoryFlag(actions) { + return actions.some((action) => action.__typename === 'FlagAction' && action.reason === 'TRUST'); +} + +const CommentLabels = ({comment, comment: {className, status, actions, hasParent}}) => { + return ( +