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/coral-admin/src/components/CommentType.css b/client/coral-admin/src/components/CommentType.css index e4851275e..969d9511d 100644 --- a/client/coral-admin/src/components/CommentType.css +++ b/client/coral-admin/src/components/CommentType.css @@ -3,12 +3,11 @@ color: white; background: grey; box-sizing: border-box; - padding: 0px 5px; - border-radius: 2px; + padding: 2px 5px; font-size: 12px; height: 24px; letter-spacing: 0.4px; - margin-bottom: 1px; + line-height: 22px; > i { font-size: 14px; diff --git a/client/coral-admin/src/components/ReplyBadge.js b/client/coral-admin/src/components/ReplyBadge.js new file mode 100644 index 000000000..5c8bb88ba --- /dev/null +++ b/client/coral-admin/src/components/ReplyBadge.js @@ -0,0 +1,11 @@ +import React from 'react'; +import {Badge} from 'coral-ui'; +import t from 'coral-framework/services/i18n'; + +const ReplyBadge = () => ( + + {t('modqueue.reply')} + +); + +export default ReplyBadge; diff --git a/client/coral-admin/src/components/UserDetailComment.css b/client/coral-admin/src/components/UserDetailComment.css index b042aea39..2dfd61cf3 100644 --- a/client/coral-admin/src/components/UserDetailComment.css +++ b/client/coral-admin/src/components/UserDetailComment.css @@ -55,7 +55,7 @@ position: relative; } -.commentType { +.badgeBar { position: absolute; right: 0px; } diff --git a/client/coral-admin/src/components/UserDetailComment.js b/client/coral-admin/src/components/UserDetailComment.js index 9b4936847..dc809b9c7 100644 --- a/client/coral-admin/src/components/UserDetailComment.js +++ b/client/coral-admin/src/components/UserDetailComment.js @@ -3,6 +3,7 @@ import {Link} from 'react-router'; import {Icon} from 'coral-ui'; import FlagBox from './FlagBox'; +import ReplyBadge from './ReplyBadge'; import styles from './UserDetailComment.css'; import CommentType from './CommentType'; import {getActionSummary} from 'coral-framework/utils'; @@ -56,7 +57,11 @@ class UserDetailComment extends React.Component { ?  ({t('comment.edited')}) : null } - + +
+ {comment.hasParent && } + +
Story: {comment.asset.title} diff --git a/client/coral-admin/src/containers/UserDetailComment.js b/client/coral-admin/src/containers/UserDetailComment.js index a70a9394d..9f0e3a793 100644 --- a/client/coral-admin/src/containers/UserDetailComment.js +++ b/client/coral-admin/src/containers/UserDetailComment.js @@ -9,6 +9,7 @@ export default withFragments({ body created_at status + hasParent asset { id title diff --git a/client/coral-admin/src/routes/Moderation/components/Comment.js b/client/coral-admin/src/routes/Moderation/components/Comment.js index 1335a8c52..c73d15eaa 100644 --- a/client/coral-admin/src/routes/Moderation/components/Comment.js +++ b/client/coral-admin/src/routes/Moderation/components/Comment.js @@ -2,6 +2,7 @@ import React, {PropTypes} from 'react'; import {Link} from 'react-router'; import {Icon} from 'coral-ui'; +import ReplyBadge from 'coral-admin/src/components/ReplyBadge'; import FlagBox from 'coral-admin/src/components/FlagBox'; import styles from './styles.css'; import CommentType from 'coral-admin/src/components/CommentType'; @@ -107,6 +108,7 @@ class Comment extends React.Component { }
+ {comment.hasParent && } ( + + {icon && } + {children} + +); + +export default Badge; diff --git a/client/coral-ui/index.js b/client/coral-ui/index.js index 8a538d120..8f261bcca 100644 --- a/client/coral-ui/index.js +++ b/client/coral-ui/index.js @@ -26,3 +26,4 @@ export {default as Option} from './components/Option'; export {default as SnackBar} from './components/SnackBar'; export {default as TextArea} from './components/TextArea'; export {default as Drawer} from './components/Drawer'; +export {default as Badge} from './components/Badge'; 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/graph/resolvers/comment.js b/graph/resolvers/comment.js index 0fd3a730c..57ebc4d56 100644 --- a/graph/resolvers/comment.js +++ b/graph/resolvers/comment.js @@ -1,6 +1,9 @@ const {decorateWithTags} = require('./util'); const Comment = { + hasParent({parent_id}) { + return !!parent_id; + }, parent({parent_id}, _, {loaders: {Comments}}) { if (parent_id == null) { return null; 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/graph/typeDefs.graphql b/graph/typeDefs.graphql index d2c1ffe1f..d83d9f75f 100644 --- a/graph/typeDefs.graphql +++ b/graph/typeDefs.graphql @@ -339,6 +339,9 @@ type Comment { # describes how the comment can be edited editing: EditInfo + + # Indicates if it has a parent + hasParent: Boolean } # CommentConnection represents a paginable subset of a comment list. diff --git a/locales/en.yml b/locales/en.yml index 54d5315d5..2ec0c816c 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -281,6 +281,7 @@ en: prev_comment: "Go to the previous comment" reject: "Reject" rejected: "Rejected" + reply: "Reply" select_stream: "Select Stream" shift_key: "⇧" shortcuts: "Shortcuts" diff --git a/locales/es.yml b/locales/es.yml index 8c3e7927b..877a42841 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -272,6 +272,7 @@ es: prev_comment: "Ir al comentario anterior" reject: "Rechazar" rejected: "rechazado" + reply: "Respuesta" select_stream: "Seleccionar hilo de comentarios" shift_key: ⇧ shortcuts: Atajos 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 @@

<%= title %>

<%= body %>

-

Admin - All Assets

+

Admin - All Assets