From e3f6327b8607f4c619a171efce0dd2f874e1f0df Mon Sep 17 00:00:00 2001
From: Riley Davis
Date: Thu, 2 Mar 2017 14:43:26 -0700
Subject: [PATCH 01/14] messages show up
---
client/coral-embed-stream/src/Embed.js | 12 ++++---
client/coral-embed/src/index.js | 44 ++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js
index da9fd4b6e..a1683b2c4 100644
--- a/client/coral-embed-stream/src/Embed.js
+++ b/client/coral-embed-stream/src/Embed.js
@@ -258,11 +258,15 @@ const mapDispatchToProps = dispatch => ({
requestConfirmEmail: () => dispatch(requestConfirmEmail()),
loadAsset: (asset) => dispatch(fetchAssetSuccess(asset)),
addNotification: (type, text) => {
- pym.sendMessage('getPosition');
+ // pym.sendMessage('getPosition');
- pym.onMessage('position', position => {
- dispatch(addNotification(type, text, position));
- });
+ console.log('addNotification', type, text);
+
+ pym.sendMessage('coral-alert', text);
+
+ // pym.onMessage('position', position => {
+ // dispatch(addNotification(type, text, position));
+ // });
},
clearNotification: () => dispatch(clearNotification()),
editName: (username) => dispatch(editName(username)),
diff --git a/client/coral-embed/src/index.js b/client/coral-embed/src/index.js
index 8d8855aa7..e590c3ecf 100644
--- a/client/coral-embed/src/index.js
+++ b/client/coral-embed/src/index.js
@@ -1,5 +1,26 @@
import pym from 'pym.js';
+const snackbarStyles = {
+ position: 'fixed',
+ cursor: 'default',
+ userSelect: 'none',
+ backgroundColor: '#323232',
+ zIndex: 3,
+ willChange: 'transform, opacity',
+ transition: 'transform .35s cubic-bezier(.55,0,.1,1), opacity .35s',
+ pointerEvents: 'none',
+ padding: '12px 18px',
+ color: '#fff',
+ borderRadius: '3px 3px 0 0',
+ textAlign: 'center',
+ maxWidth: '300px',
+ left: '50%',
+ opacity: 0,
+ transform: 'translate(-50%, 20px)',
+ bottom: 0,
+ boxSizing: 'border-box'
+};
+
// This function should return value of window.Coral
const Coral = {};
const Talk = Coral.Talk = {};
@@ -32,6 +53,14 @@ function configurePymParent(pymParent, asset_url) {
let notificationOffset = 200;
let ready = false;
let cachedHeight;
+ const snackbar = document.createElement('div');
+ snackbar.id = 'coral-snackbar';
+
+ for (let key in snackbarStyles) {
+ snackbar.style[key] = snackbarStyles[key];
+ }
+
+ window.document.body.appendChild(snackbar);
// Resize parent iframe height when child height changes
pymParent.onMessage('height', function(height) {
@@ -41,6 +70,21 @@ function configurePymParent(pymParent, asset_url) {
}
});
+ pymParent.onMessage('coral-alert', function (message) {
+ snackbar.style.transform = 'translate(-50%, 20px)';
+ snackbar.style.opacity = 0;
+ snackbar.textContent = message;
+
+ setTimeout(() => {
+ snackbar.style.transform = 'translate(-50%, 0)';
+ snackbar.style.opacity = 1;
+ }, 0);
+
+ setTimeout(() => {
+ snackbar.style.opacity = 0;
+ }, 5000);
+ });
+
// Helps child show notifications at the right scrollTop
pymParent.onMessage('getPosition', function() {
let position = viewport().height + document.body.scrollTop;
From b92ea72b789d8e120d33691050da9f0452fabc82 Mon Sep 17 00:00:00 2001
From: David Jay
Date: Thu, 2 Mar 2017 16:44:36 -0500
Subject: [PATCH 02/14] Re-enabling premod links in settings.
---
.../components/ConfigureCommentStream.js | 12 ++++++++++++
.../containers/ConfigureStreamContainer.js | 18 +++++++++---------
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/client/coral-configure/components/ConfigureCommentStream.js b/client/coral-configure/components/ConfigureCommentStream.js
index d80e487de..348d26f53 100644
--- a/client/coral-configure/components/ConfigureCommentStream.js
+++ b/client/coral-configure/components/ConfigureCommentStream.js
@@ -34,6 +34,18 @@ export default ({handleChange, handleApply, changed, updateQuestionBoxContent, .
description: lang.t('configureCommentStream.enablePremodDescription')
}} />
+
+
+
@@ -88,11 +88,11 @@ class ConfigureStreamContainer extends Component {
handleChange={this.handleChange}
handleApply={this.handleApply}
changed={this.state.changed}
- premodLinks={false}
+ premodLinks={settings.premodLinks}
premod={premod}
updateQuestionBoxContent={this.updateQuestionBoxContent}
- questionBoxEnable={questionBoxEnable}
- questionBoxContent={questionBoxContent}
+ questionBoxEnable={settings.questionBoxEnable}
+ questionBoxContent={settings.questionBoxContent}
/>
{status === 'open' ? 'Close' : 'Open'} Comment Stream
From cb88f0a9b79c91d2e0fb3b1a82f18d7046002e1a Mon Sep 17 00:00:00 2001
From: David Jay
Date: Fri, 3 Mar 2017 14:32:57 -0500
Subject: [PATCH 03/14] Flagging links when settings are set appropriately.
---
.../containers/ConfigureStreamContainer.js | 4 ++--
graph/mutators/comment.js | 24 +++++++++++++++----
graph/typeDefs.graphql | 1 +
models/setting.js | 4 ++++
4 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js
index 35942288e..a621f0cbd 100644
--- a/client/coral-configure/containers/ConfigureStreamContainer.js
+++ b/client/coral-configure/containers/ConfigureStreamContainer.js
@@ -31,14 +31,14 @@ class ConfigureStreamContainer extends Component {
const questionBoxEnable = elements.qboxenable.checked;
const questionBoxContent = elements.qboxcontent.value;
- const premodLinks = elements.premodLinks.checked;
+ const premodLinksEnable = elements.premodLinks.checked;
const {changed} = this.state;
const newConfig = {
moderation: premod ? 'PRE' : 'POST',
questionBoxEnable,
questionBoxContent,
- premodLinks
+ premodLinksEnable
};
if (changed) {
diff --git a/graph/mutators/comment.js b/graph/mutators/comment.js
index d608eee57..73510d67a 100644
--- a/graph/mutators/comment.js
+++ b/graph/mutators/comment.js
@@ -54,13 +54,16 @@ const createComment = ({user, loaders: {Comments}}, {body, asset_id, parent_id =
* @param {String} body body of a comment
* @return {Object} resolves to the wordlist results
*/
-const filterNewComment = (context, {body}) => {
+const filterNewComment = (context, {body, asset_id}) => {
// Create a new instance of the Wordlist.
const wl = new Wordlist();
// Load the wordlist and filter the comment content.
- return wl.load().then(() => wl.scan('body', body));
+ return Promise.all([
+ wl.load().then(() => wl.scan('body', body)),
+ AssetsService.rectifySettings(AssetsService.findById(asset_id))
+ ]);
};
/**
@@ -131,13 +134,13 @@ const createPublicComment = (context, commentInput) => {
// We then take the wordlist and the comment into consideration when
// considering what status to assign the new comment, and resolve the new
// status to set the comment to.
- .then((wordlist) => resolveNewCommentStatus(context, commentInput, wordlist)
+ .then(([wordlist, settings]) => resolveNewCommentStatus(context, commentInput, wordlist)
// Then we actually create the comment with the new status.
.then((status) => createComment(context, commentInput, status))
.then((comment) => {
- // If the comment was flagged as being suspect, we need to add a
+ // If the comment has a suspect word or a link, we need to add a
// flag to it to indicate that it needs to be looked at.
// Otherwise just return the new comment.
@@ -158,6 +161,19 @@ const createPublicComment = (context, commentInput) => {
.then(() => comment);
}
+ // If the comment contains a link.
+ if (settings.premodLinksEnable && /\S+\.\S+/.exec(comment.body)) {
+ return ActionsService.insertUserAction({
+ item_id: comment.id,
+ item_type: 'COMMENTS',
+ action_type: 'FLAG',
+ user_id: null,
+ group_id: 'Contains link',
+ metadata: {}
+ })
+ .then(() => comment);
+ }
+
// Finally, we return the comment.
return comment;
}));
diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql
index 92f0d41e2..2777e7bdb 100644
--- a/graph/typeDefs.graphql
+++ b/graph/typeDefs.graphql
@@ -370,6 +370,7 @@ type Settings {
infoBoxEnable: Boolean
infoBoxContent: String
+ premodLinksEnable: Boolean
questionBoxEnable: Boolean
questionBoxContent: String
closeTimeout: Int
diff --git a/models/setting.js b/models/setting.js
index 993384ff1..ac54584a4 100644
--- a/models/setting.js
+++ b/models/setting.js
@@ -40,6 +40,10 @@ const SettingSchema = new Schema({
type: String,
default: ''
},
+ premodLinksEnable: {
+ type: Boolean,
+ default: false
+ },
organizationName: {
type: String
},
From 2e5d453ea7eb32415aa4cb32a6597f43557b9628 Mon Sep 17 00:00:00 2001
From: David Jay
Date: Fri, 3 Mar 2017 15:44:03 -0500
Subject: [PATCH 04/14] Updating link search and adding settings in admin
panel.
---
.../src/containers/Configure/StreamSettings.js | 18 ++++++++++++++++++
.../ModerationQueue/components/Comment.js | 1 +
client/coral-admin/src/translations.json | 2 ++
graph/mutators/comment.js | 3 ++-
package.json | 1 +
5 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/client/coral-admin/src/containers/Configure/StreamSettings.js b/client/coral-admin/src/containers/Configure/StreamSettings.js
index 568e0a075..950c5a2aa 100644
--- a/client/coral-admin/src/containers/Configure/StreamSettings.js
+++ b/client/coral-admin/src/containers/Configure/StreamSettings.js
@@ -32,6 +32,11 @@ const updateInfoBoxEnable = (updateSettings, infoBox) => () => {
updateSettings({infoBoxEnable});
};
+const updatePremodLinksEnable = (updateSettings, premodLinks) => () => {
+ const premodLinksEnable = !premodLinks;
+ updateSettings({premodLinksEnable});
+};
+
const updateInfoBoxContent = (updateSettings) => (event) => {
const infoBoxContent = event.target.value;
updateSettings({infoBoxContent});
@@ -92,6 +97,19 @@ const StreamSettings = ({updateSettings, settingsError, settings, errors}) => {
+
+
+
+
+
+ {lang.t('configure.enable-premod-links')}
+
+ {lang.t('configure.enable-premod-links-text')}
+
+
+
{
const links = linkify.getMatches(props.comment.body);
+ console.log('Links', links);
const actionSummaries = props.comment.action_summaries;
return (
{
}
// If the comment contains a link.
- if (settings.premodLinksEnable && /\S+\.\S+/.exec(comment.body)) {
+ if (settings.premodLinksEnable && linkify.test(comment.body)) {
return ActionsService.insertUserAction({
item_id: comment.id,
item_type: 'COMMENTS',
diff --git a/package.json b/package.json
index 740063dd1..6f0fd24c1 100644
--- a/package.json
+++ b/package.json
@@ -70,6 +70,7 @@
"inquirer": "^3.0.1",
"jsonwebtoken": "^7.1.9",
"kue": "^0.11.5",
+ "linkify-it": "^2.0.3",
"lodash": "^4.16.6",
"metascraper": "^1.0.6",
"minimist": "^1.2.0",
From b912b60428a286014e1634a756118ffe48cd4d32 Mon Sep 17 00:00:00 2001
From: David Jay
Date: Fri, 3 Mar 2017 16:01:53 -0500
Subject: [PATCH 05/14] Removing unecessary log statement.
---
.../src/containers/ModerationQueue/components/Comment.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js
index 44f693ff5..3a82af2cd 100644
--- a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js
+++ b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js
@@ -19,7 +19,6 @@ const lang = new I18n(translations);
const Comment = ({actions = [], ...props}) => {
const links = linkify.getMatches(props.comment.body);
- console.log('Links', links);
const actionSummaries = props.comment.action_summaries;
return (
Date: Fri, 3 Mar 2017 16:09:34 -0500
Subject: [PATCH 06/14] Updating moderation.
---
client/coral-admin/src/translations.json | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/client/coral-admin/src/translations.json b/client/coral-admin/src/translations.json
index c729bb2e5..3294fe84a 100644
--- a/client/coral-admin/src/translations.json
+++ b/client/coral-admin/src/translations.json
@@ -66,8 +66,8 @@
"include-comment-stream": "Include Comment Stream Description for Readers.",
"include-comment-stream-desc": "Write a message to be added to the top of your comment stream. Pose a topic, include community guidelines, etc.",
"include-text": "Include your text here.",
- "enable-premod-links": "Moderate all comments with links",
- "enable-premod-links-text": "Automatically send comments with links to the moderation queue.",
+ "enable-premod-links": "Pre-Moderate Comments Containing Links",
+ "enable-premod-links-text": "Moderators must approve any comment containing a link before its published.",
"comment-settings": "Settings",
"embed-comment-stream": "Embed Stream",
"banned-word-text": "Comments which contain these words or phrases (not case-sensitive) will be automatically removed from the comment stream. Type a word and press Enter or Tab to add. Optionally paste a comma-separated list.",
@@ -195,6 +195,8 @@
"include-text": "Incluir tu texto aqui.",
"comment-settings": "Configuración de Comentarios",
"embed-comment-stream": "Colocar Hilo de Comentarios",
+ "enable-premod-links": "Pre-Moderar Commentarios que contienen Links",
+ "enable-premod-links-text": "Los y las Moderadoras deben probar cualquier comentario que contengan links antes de su publicación.",
"wordlist": "Palabras Suspendidas y Suspechosas",
"banned-word-text": "Comentarios que contengan estas palabras o frases, no separadas por comas y en mayusculas o minusuculas, serán automaticamente separadas de los comentarios publicados.",
"suspect-word-text": "Comments which contain these words or phrases (not case-sensitive) will be highlighted in the comment stream. Type a word and press Enter or Tab to add. Optionally paste a comma-separated list.",
From be8332da667ab099323cdb5fc034a6ec01fe1ad9 Mon Sep 17 00:00:00 2001
From: David Jay
Date: Fri, 3 Mar 2017 16:12:53 -0500
Subject: [PATCH 07/14] Switching link action from flag to premod.
---
graph/mutators/comment.js | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/graph/mutators/comment.js b/graph/mutators/comment.js
index 3f6664cfc..620601851 100644
--- a/graph/mutators/comment.js
+++ b/graph/mutators/comment.js
@@ -76,7 +76,7 @@ const filterNewComment = (context, {body, asset_id}) => {
* @param {Object} [wordlist={}] the results of the wordlist scan
* @return {Promise} resolves to the comment's status
*/
-const resolveNewCommentStatus = (context, {asset_id, body}, wordlist = {}) => {
+const resolveNewCommentStatus = (context, {asset_id, body}, wordlist = {}, settings) => {
// Decide the status based on whether or not the current asset/settings
// has pre-mod enabled or not. If the comment was rejected based on the
@@ -86,6 +86,8 @@ const resolveNewCommentStatus = (context, {asset_id, body}, wordlist = {}) => {
if (wordlist.banned) {
status = Promise.resolve('REJECTED');
+ } else if (settings.premodLinksEnable && linkify.test(body)) {
+ status = Promise.resolve('PREMOD');
} else {
status = AssetsService
.rectifySettings(AssetsService.findById(asset_id).then((asset) => {
@@ -135,7 +137,7 @@ const createPublicComment = (context, commentInput) => {
// We then take the wordlist and the comment into consideration when
// considering what status to assign the new comment, and resolve the new
// status to set the comment to.
- .then(([wordlist, settings]) => resolveNewCommentStatus(context, commentInput, wordlist)
+ .then(([wordlist, settings]) => resolveNewCommentStatus(context, commentInput, wordlist, settings)
// Then we actually create the comment with the new status.
.then((status) => createComment(context, commentInput, status))
@@ -162,19 +164,6 @@ const createPublicComment = (context, commentInput) => {
.then(() => comment);
}
- // If the comment contains a link.
- if (settings.premodLinksEnable && linkify.test(comment.body)) {
- return ActionsService.insertUserAction({
- item_id: comment.id,
- item_type: 'COMMENTS',
- action_type: 'FLAG',
- user_id: null,
- group_id: 'Contains link',
- metadata: {}
- })
- .then(() => comment);
- }
-
// Finally, we return the comment.
return comment;
}));
From 000833509fcad36e922c60215cd965054c8f8b12 Mon Sep 17 00:00:00 2001
From: Riley Davis
Date: Mon, 6 Mar 2017 10:59:12 -0700
Subject: [PATCH 08/14] remove notification reducer. have parent show
notifications
---
client/coral-embed-stream/src/Embed.js | 27 ++------------
client/coral-embed/src/index.js | 10 ++++--
.../coral-framework/actions/notification.js | 16 +++------
client/coral-framework/index.js | 2 --
.../modules/notification/Notification.js | 22 ------------
client/coral-framework/reducers/index.js | 2 --
.../coral-framework/reducers/notification.js | 24 -------------
.../reducers/notificationReducer.spec.js | 35 -------------------
.../store/notificationReducer.spec.js | 35 -------------------
9 files changed, 15 insertions(+), 158 deletions(-)
delete mode 100644 client/coral-framework/modules/notification/Notification.js
delete mode 100644 client/coral-framework/reducers/notification.js
delete mode 100644 test/client/coral-framework/reducers/notificationReducer.spec.js
delete mode 100644 test/client/coral-framework/store/notificationReducer.spec.js
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js
index a1683b2c4..64b2c1e9b 100644
--- a/client/coral-embed-stream/src/Embed.js
+++ b/client/coral-embed-stream/src/Embed.js
@@ -16,7 +16,7 @@ import {queryStream} from 'coral-framework/graphql/queries';
import {postComment, postFlag, postLike, postDontAgree, deleteAction} from 'coral-framework/graphql/mutations';
import {editName} from 'coral-framework/actions/user';
import {updateCountCache} from 'coral-framework/actions/asset';
-import {Notification, notificationActions, authActions, assetActions, pym} from 'coral-framework';
+import {notificationActions, authActions, assetActions, pym} from 'coral-framework';
import Stream from './Stream';
import InfoBox from 'coral-plugin-infobox/InfoBox';
@@ -170,7 +170,7 @@ class Embed extends Component {
refetch={refetch}
setActiveReplyBox={this.setActiveReplyBox}
activeReplyBox={this.state.activeReplyBox}
- addNotification={addNotification}
+ addNotification={this.props.addNotification}
depth={0}
postItem={this.props.postItem}
asset={asset}
@@ -210,11 +210,6 @@ class Embed extends Component {
deleteAction={this.props.deleteAction}
showSignInDialog={this.props.showSignInDialog}
comments={asset.comments} />
-
-
);
@@ -248,7 +238,6 @@ class Embed extends Component {
}
const mapStateToProps = state => ({
- notification: state.notification.toJS(),
auth: state.auth.toJS(),
userData: state.user.toJS(),
asset: state.asset.toJS()
@@ -257,17 +246,7 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => ({
requestConfirmEmail: () => dispatch(requestConfirmEmail()),
loadAsset: (asset) => dispatch(fetchAssetSuccess(asset)),
- addNotification: (type, text) => {
- // pym.sendMessage('getPosition');
-
- console.log('addNotification', type, text);
-
- pym.sendMessage('coral-alert', text);
-
- // pym.onMessage('position', position => {
- // dispatch(addNotification(type, text, position));
- // });
- },
+ addNotification: (type, text) => dispatch(addNotification(type, text)),
clearNotification: () => dispatch(clearNotification()),
editName: (username) => dispatch(editName(username)),
showSignInDialog: (offset) => dispatch(showSignInDialog(offset)),
diff --git a/client/coral-embed/src/index.js b/client/coral-embed/src/index.js
index e590c3ecf..db4cbf37e 100644
--- a/client/coral-embed/src/index.js
+++ b/client/coral-embed/src/index.js
@@ -54,7 +54,7 @@ function configurePymParent(pymParent, asset_url) {
let ready = false;
let cachedHeight;
const snackbar = document.createElement('div');
- snackbar.id = 'coral-snackbar';
+ snackbar.id = 'coral-notif';
for (let key in snackbarStyles) {
snackbar.style[key] = snackbarStyles[key];
@@ -70,10 +70,16 @@ function configurePymParent(pymParent, asset_url) {
}
});
+ pymParent.onMessage('coral-clear-notification', function () {
+ snackbar.style.opacity = 0;
+ });
+
pymParent.onMessage('coral-alert', function (message) {
+ const [type, text] = message.split('|');
snackbar.style.transform = 'translate(-50%, 20px)';
snackbar.style.opacity = 0;
- snackbar.textContent = message;
+ snackbar.className = `coral-notif-${type}`;
+ snackbar.textContent = text;
setTimeout(() => {
snackbar.style.transform = 'translate(-50%, 0)';
diff --git a/client/coral-framework/actions/notification.js b/client/coral-framework/actions/notification.js
index f0ac4d951..f2cc053ec 100644
--- a/client/coral-framework/actions/notification.js
+++ b/client/coral-framework/actions/notification.js
@@ -1,17 +1,9 @@
-export const ADD_NOTIFICATION = 'ADD_NOTIFICATION';
-export const CLEAR_NOTIFICATION = 'CLEAR_NOTIFICATION';
+import {pym} from 'coral-framework';
-export const addNotification = (notifType, text, position) => {
- return {
- type: ADD_NOTIFICATION,
- notifType,
- text,
- position
- };
+export const addNotification = (notifType, text) => {
+ pym.sendMessage('coral-alert', `${notifType}|${text}`);
};
export const clearNotification = () => {
- return {
- type: CLEAR_NOTIFICATION
- };
+ pym.sendMessage('coral-clear-notification');
};
diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js
index 56a2e522c..2900466ee 100644
--- a/client/coral-framework/index.js
+++ b/client/coral-framework/index.js
@@ -4,7 +4,6 @@ import I18n from './modules/i18n/i18n';
import * as authActions from './actions/auth';
import * as assetActions from './actions/asset';
import * as notificationActions from './actions/notification';
-import Notification from './modules/notification/Notification';
export {
pym,
@@ -12,6 +11,5 @@ export {
store,
authActions,
assetActions,
- Notification,
notificationActions
};
diff --git a/client/coral-framework/modules/notification/Notification.js b/client/coral-framework/modules/notification/Notification.js
deleted file mode 100644
index 709403976..000000000
--- a/client/coral-framework/modules/notification/Notification.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import React from 'react';
-import {SnackBar} from 'coral-ui';
-
-const Notification = (props) => {
- if (props.notification.text) {
- setTimeout(() => {
- props.clearNotification();
- }, props.notifLength);
- }
- return (
-
- {
- props.notification.text &&
-
- {props.notification.text}
-
- }
-
- );
-};
-
-export default Notification;
diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js
index 720f15232..9e98c901a 100644
--- a/client/coral-framework/reducers/index.js
+++ b/client/coral-framework/reducers/index.js
@@ -1,11 +1,9 @@
import auth from './auth';
import user from './user';
import asset from './asset';
-import notification from './notification';
export default {
auth,
user,
asset,
- notification
};
diff --git a/client/coral-framework/reducers/notification.js b/client/coral-framework/reducers/notification.js
deleted file mode 100644
index fbc58230f..000000000
--- a/client/coral-framework/reducers/notification.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import * as actions from '../actions/notification';
-import {Map} from 'immutable';
-
-const initialState = Map({
- text: '',
- type: '',
- position: 400
-});
-
-export default (state = initialState, action) => {
- switch (action.type) {
- case actions.ADD_NOTIFICATION:
- return state
- .merge({
- type: action.notifType,
- text: action.text,
- position: action.position
- });
- case actions.CLEAR_NOTIFICATION:
- return initialState;
- default:
- return state;
- }
-};
diff --git a/test/client/coral-framework/reducers/notificationReducer.spec.js b/test/client/coral-framework/reducers/notificationReducer.spec.js
deleted file mode 100644
index 40c50d11a..000000000
--- a/test/client/coral-framework/reducers/notificationReducer.spec.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import {Map} from 'immutable';
-import {expect} from 'chai';
-import notificationReducer from '../../../../client/coral-framework/reducers/notification';
-import * as actions from '../../../../client/coral-framework/actions/notification';
-
-describe ('notificationsReducer', () => {
- describe('ADD_NOTIFICATION', () => {
- it('should add a notification', () => {
- const action = {
- type: actions.ADD_NOTIFICATION,
- text: 'Test notification',
- notifType: 'test'
- };
- const store = new Map({});
- const result = notificationReducer(store, action);
- expect(result.get('text')).to.equal(action.text);
- expect(result.get('type')).to.equal(action.notifType);
- });
- });
-
- describe('CLEAR_NOTIFICATION', () => {
- it('should clear a notification', () => {
- const action = {
- type: actions.CLEAR_NOTIFICATION
- };
- const store = new Map({
- text: 'Test notification',
- type: 'test'
- });
- const result = notificationReducer(store, action);
- expect(result.get('text')).to.equal('');
- expect(result.get('type')).to.equal('');
- });
- });
-});
diff --git a/test/client/coral-framework/store/notificationReducer.spec.js b/test/client/coral-framework/store/notificationReducer.spec.js
deleted file mode 100644
index 40c50d11a..000000000
--- a/test/client/coral-framework/store/notificationReducer.spec.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import {Map} from 'immutable';
-import {expect} from 'chai';
-import notificationReducer from '../../../../client/coral-framework/reducers/notification';
-import * as actions from '../../../../client/coral-framework/actions/notification';
-
-describe ('notificationsReducer', () => {
- describe('ADD_NOTIFICATION', () => {
- it('should add a notification', () => {
- const action = {
- type: actions.ADD_NOTIFICATION,
- text: 'Test notification',
- notifType: 'test'
- };
- const store = new Map({});
- const result = notificationReducer(store, action);
- expect(result.get('text')).to.equal(action.text);
- expect(result.get('type')).to.equal(action.notifType);
- });
- });
-
- describe('CLEAR_NOTIFICATION', () => {
- it('should clear a notification', () => {
- const action = {
- type: actions.CLEAR_NOTIFICATION
- };
- const store = new Map({
- text: 'Test notification',
- type: 'test'
- });
- const result = notificationReducer(store, action);
- expect(result.get('text')).to.equal('');
- expect(result.get('type')).to.equal('');
- });
- });
-});
From 450f1fdbac94b1e744bab9af533ab61a3c2ded20 Mon Sep 17 00:00:00 2001
From: David Jay
Date: Mon, 6 Mar 2017 13:25:01 -0500
Subject: [PATCH 09/14] Focusing on reply box when reply is clicked.
---
client/coral-plugin-replies/ReplyBox.js | 36 +++++++++++++++----------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/client/coral-plugin-replies/ReplyBox.js b/client/coral-plugin-replies/ReplyBox.js
index c50bca124..807ad6699 100644
--- a/client/coral-plugin-replies/ReplyBox.js
+++ b/client/coral-plugin-replies/ReplyBox.js
@@ -1,21 +1,29 @@
-import React, {PropTypes} from 'react';
+import React, {Component, PropTypes} from 'react';
import CommentBox from '../coral-plugin-commentbox/CommentBox';
const name = 'coral-plugin-replies';
-const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentId, commentPostedHandler, setActiveReplyBox}) => (
-
-
-
-);
+class ReplyBox extends Component {
+
+ componentDidMount() {
+ document.getElementById('replyText').focus();
+ }
+
+ render() {
+ const {styles, postItem, assetId, authorId, addNotification, parentId, commentPostedHandler, setActiveReplyBox} = this.props;
+ return
+
+
;
+ }
+}
ReplyBox.propTypes = {
setActiveReplyBox: PropTypes.func.isRequired,
From 78a2a64671670e85ce32ba974b1aa9dfc92e82de Mon Sep 17 00:00:00 2001
From: David Jay
Date: Tue, 7 Mar 2017 13:13:21 -0500
Subject: [PATCH 10/14] Not displaying premod or rejected comments.
---
client/coral-framework/graphql/mutations/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js
index a874f8f0c..7dd8bf12b 100644
--- a/client/coral-framework/graphql/mutations/index.js
+++ b/client/coral-framework/graphql/mutations/index.js
@@ -42,7 +42,7 @@ export const postComment = graphql(POST_COMMENT, {
updateQueries: {
AssetQuery: (oldData, {mutationResult:{data:{createComment:{comment}}}}) => {
- if (oldData.asset.settings.moderation === 'PRE') {
+ if (oldData.asset.settings.moderation === 'PRE' || comment.status === 'PREMOD' || comment.status === 'REJECTED') {
return oldData;
}
From dc96b550a6ae86edd9aba30f5ee2e1e242a930c8 Mon Sep 17 00:00:00 2001
From: Belen Curcio
Date: Tue, 7 Mar 2017 14:56:28 -0500
Subject: [PATCH 11/14] Button should inherit font
---
client/coral-ui/components/Button.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/coral-ui/components/Button.css b/client/coral-ui/components/Button.css
index 9a2611630..14ed64aa2 100644
--- a/client/coral-ui/components/Button.css
+++ b/client/coral-ui/components/Button.css
@@ -9,7 +9,7 @@
min-width: 64px;
padding: 0 8px;
display: inline-block;
- font-family: 'Roboto','Helvetica','Arial',sans-serif;
+ font-family: inherit;
font-size: 14px;
overflow: hidden;
will-change: box-shadow,transform;
From ee30f549a136fb7092ac69861e0f44148f589200 Mon Sep 17 00:00:00 2001
From: Belen Curcio
Date: Tue, 7 Mar 2017 15:04:35 -0500
Subject: [PATCH 12/14] Lato all the things
---
client/coral-embed-stream/style/default.css | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css
index 009246963..bb5b98d33 100644
--- a/client/coral-embed-stream/style/default.css
+++ b/client/coral-embed-stream/style/default.css
@@ -1,10 +1,16 @@
+* {
+ font-weight: inherit;
+ font-family: inherit;
+ font-style: inherit;
+ font-size: 100%;
+}
+
html, body {
width:auto;
height:auto;
}
body {
- font-family: 'Open Sans', sans-serif;
font-family: 'Lato', sans-serif;
width: 100%;
font-size: 14px;
@@ -324,14 +330,14 @@ button.comment__action-button[disabled],
}
.coral-plugin-flags-popup-counter {
- float: left;
- margin-top: 21px;
- color: #999;
+ float: left;
+ margin-top: 21px;
+ color: #999;
}
.coral-plugin-flags-popup-button {
- float: right;
- margin-top: 10px;
+ float: right;
+ margin-top: 10px;
}
.coral-plugin-flags-reason-text {
From eb06f3892d1b2f0dff651a66e91bf9baa1c4e96a Mon Sep 17 00:00:00 2001
From: Belen Curcio
Date: Tue, 7 Mar 2017 15:27:43 -0500
Subject: [PATCH 13/14] changes
---
client/coral-embed-stream/style/default.css | 5 +++++
client/coral-plugin-commentbox/translations.json | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css
index bb5b98d33..5b1b69752 100644
--- a/client/coral-embed-stream/style/default.css
+++ b/client/coral-embed-stream/style/default.css
@@ -87,6 +87,7 @@ hr {
margin-bottom: 10px;
display: block;
box-sizing: border-box;
+ border-radius: 2px;
}
/* Question Box Styles */
@@ -134,6 +135,8 @@ hr {
flex: 1;
padding: 5px;
min-height: 100px;
+ margin-top: 10px;
+ font-size: 14px;
}
.coral-plugin-commentbox-button-container {
@@ -393,6 +396,8 @@ button.coral-load-more {
color: #FFF;
background-color: #2376D8;
cursor: pointer;
+ padding: 10px;
+ border-radius: 2px;
}
button.coral-load-more:hover {
diff --git a/client/coral-plugin-commentbox/translations.json b/client/coral-plugin-commentbox/translations.json
index 83ed974e4..0f77fc334 100644
--- a/client/coral-plugin-commentbox/translations.json
+++ b/client/coral-plugin-commentbox/translations.json
@@ -3,7 +3,7 @@
"post": "Post",
"cancel": "Cancel",
"reply": "Reply",
- "comment": "Comment",
+ "comment": "Post a Comment",
"name": "Name",
"comment-post-notif": "Your comment has been posted.",
"comment-post-notif-premod": "Thank you for posting. Our moderation team will review your comment shortly.",
@@ -14,7 +14,7 @@
"post": "Publicar",
"cancel": "Cancelar",
"reply": "Respuesta",
- "comment": "Comentario",
+ "comment": "Escribe un Comentario",
"name": "Nombre",
"comment-post-notif": "Tu comentario ha sido publicado.",
"comment-post-notif-premod": "Gracias por comentar. Nuestro equipo de moderación va a revisarlo muy pronto.",
From d1119604e05ca9759175c83708818c5a7c64c80f Mon Sep 17 00:00:00 2001
From: Belen Curcio
Date: Tue, 7 Mar 2017 15:59:05 -0500
Subject: [PATCH 14/14] =?UTF-8?q?=C3=ADcon=20styling=20for=20infobox?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
client/coral-embed-stream/style/default.css | 43 +++++++++++++++----
.../coral-plugin-questionbox/QuestionBox.js | 8 ++--
2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css
index 5b1b69752..68bac3110 100644
--- a/client/coral-embed-stream/style/default.css
+++ b/client/coral-embed-stream/style/default.css
@@ -90,6 +90,14 @@ hr {
border-radius: 2px;
}
+
+.commentStream .material-icons {
+ vertical-align: middle;
+ width: 1em;
+ font-size: 1em;
+ overflow: hidden;
+}
+
/* Question Box Styles */
.coral-plugin-questionbox-info {
top: 0;
@@ -103,15 +111,41 @@ hr {
font-weight: bold;
font-size: 14px;
display: block;
+ overflow: hidden;
+ height: 50px;
}
-.coral-plugin-questionbox-icon {
+.coral-plugin-questionbox-icon.bubble{
+ position: absolute;
+ top: 11px;
+ left: 15px;
+ color: #949393;
+ font-size: 20px;
+ z-index: 0;
+}
+
+.coral-plugin-questionbox-icon.person{
+ z-index: 2;
+ top: 20px;
+ left: 20px;
+ position: absolute;
+ font-size: 24px;
+ color: white;
+}
+
+.coral-plugin-questionbox-box {
+ position: relative;
border: 0;
background: black;
color: white;
padding: 20px;
margin-left: 0px !important;
margin-right: 10px;
+ display: inline-block;
+ width: 15px;
+ height: 100%;
+ padding: 3px 20px;
+ vertical-align: middle;
}
.hidden {
@@ -247,13 +281,6 @@ button.comment__action-button[disabled],
white-space: nowrap;
}
-.commentStream .material-icons {
- vertical-align: middle;
- width: 1em;
- font-size: 1em;
- overflow: hidden;
-}
-
.likedButton {
color: rgb(0,134,227);
}
diff --git a/client/coral-plugin-questionbox/QuestionBox.js b/client/coral-plugin-questionbox/QuestionBox.js
index 542cb8790..3c2410d44 100644
--- a/client/coral-plugin-questionbox/QuestionBox.js
+++ b/client/coral-plugin-questionbox/QuestionBox.js
@@ -2,9 +2,11 @@ import React from 'react';
const packagename = 'coral-plugin-questionbox';
const QuestionBox = ({enable, content}) =>
-
-
chat_bubble person
+
+
+ chat_bubble
+ person
+
{content}
;