diff --git a/client/coral-admin/src/reducers/moderation.js b/client/coral-admin/src/reducers/moderation.js
index cf270543c..a40ac865f 100644
--- a/client/coral-admin/src/reducers/moderation.js
+++ b/client/coral-admin/src/reducers/moderation.js
@@ -6,7 +6,8 @@ const initialState = Map({
modalOpen: false,
user: Map({}),
commentId: null,
- banDialog: false
+ banDialog: false,
+ shortcutsNoteVisible: window.localStorage.getItem('coral:shortcutsNote') || 'show'
});
export default function moderation (state = initialState, action) {
@@ -31,6 +32,9 @@ export default function moderation (state = initialState, action) {
case actions.SINGLE_VIEW:
return state
.set('singleView', !state.get('singleView'));
+ case actions.HIDE_SHORTCUTS_NOTE:
+ return state
+ .set('shortcutsNoteVisible', 'hide');
default :
return state;
}
diff --git a/client/coral-admin/src/translations.json b/client/coral-admin/src/translations.json
index f317b71a7..9e167232e 100644
--- a/client/coral-admin/src/translations.json
+++ b/client/coral-admin/src/translations.json
@@ -44,6 +44,10 @@
"close": "Close",
"actions": "Actions",
"navigation": "Navigation",
+ "mod-faster": "Moderate faster with keyboard shortcuts",
+ "try-these": "Try these",
+ "view-more-shortcuts": "View more shortcuts",
+ "shift-key": "⇧",
"approve": "Approve comment",
"reject": "Reject comment",
"nextcomment": "Go to the next comment",
@@ -226,6 +230,10 @@
"rejected": "rechazado",
"flagged": "marcado",
"shortcuts": "Atajos de teclado",
+ "mod-faster": "Moderar más rápido con atajos del teclado",
+ "try-these": "Intenta estos",
+ "view-more-shortcuts": "Ver más atajos",
+ "shift-key": "⇧",
"close": "Cerrar",
"emptyqueue": "No se encontro ningún usuario. Están escondidos.",
"showshortcuts": "Mostrar atajos",
diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js
index 674c03ec5..63b3ef8dc 100644
--- a/client/coral-embed-stream/src/Comment.js
+++ b/client/coral-embed-stream/src/Comment.js
@@ -64,6 +64,8 @@ class Comment extends React.Component {
currentUser: PropTypes.shape({
id: PropTypes.string.isRequired
}),
+ charCountEnable: PropTypes.bool.isRequired,
+ maxCharCount: PropTypes.number,
comment: PropTypes.shape({
depth: PropTypes.number,
action_summaries: PropTypes.array.isRequired,
@@ -121,6 +123,8 @@ class Comment extends React.Component {
ignoreUser,
disableReply,
commentIsIgnored,
+ maxCharCount,
+ charCountEnable,
} = this.props;
const likeSummary = getActionSummary('LikeActionSummary', comment);
@@ -243,6 +247,8 @@ class Comment extends React.Component {
commentPostedHandler={() => {
setActiveReplyBox('');
}}
+ charCountEnable={charCountEnable}
+ maxCharCount={maxCharCount}
setActiveReplyBox={setActiveReplyBox}
parentId={parentId || comment.id}
addNotification={addNotification}
@@ -273,6 +279,8 @@ class Comment extends React.Component {
addCommentTag={addCommentTag}
removeCommentTag={removeCommentTag}
ignoreUser={ignoreUser}
+ charCountEnable={charCountEnable}
+ maxCharCount={maxCharCount}
showSignInDialog={showSignInDialog}
reactKey={reply.id}
key={reply.id}
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js
index f4cde5d05..9a74d2d37 100644
--- a/client/coral-embed-stream/src/Embed.js
+++ b/client/coral-embed-stream/src/Embed.js
@@ -159,6 +159,10 @@ class Embed extends React.Component {
const userBox =
this.props.logout().then(refetch)} changeTab={this.changeTab}/>;
+ // TODO: This is a quickfix and will be replaced after our refactor.
+ const ignoredUsers = this.props.userData.ignoredUsers;
+ const commentIsIgnored = (comment) => ignoredUsers && ignoredUsers.includes(comment.user.id);
+
return (
@@ -210,7 +214,8 @@ class Embed extends React.Component {
isReply={false}
currentUser={this.props.auth.user}
authorId={user.id}
- charCount={asset.settings.charCountEnable && asset.settings.charCount} />
+ charCountEnable={asset.settings.charCountEnable}
+ maxCharCount={asset.settings.charCount} />
: null
}
@@ -242,6 +247,7 @@ class Embed extends React.Component {
loadMore={this.props.loadMore}
deleteAction={this.props.deleteAction}
showSignInDialog={this.props.showSignInDialog}
+ commentIsIgnored={commentIsIgnored}
key={highlightedComment.id}
reactKey={highlightedComment.id}
comment={highlightedComment} />
@@ -273,6 +279,8 @@ class Embed extends React.Component {
deleteAction={this.props.deleteAction}
showSignInDialog={this.props.showSignInDialog}
comments={asset.comments}
+ maxCharCount={asset.settings.charCount}
+ charCountEnable={asset.settings.charCountEnable}
ignoredUsers={this.props.userData.ignoredUsers} />
ignoredUsers && ignoredUsers.includes(comment.user.id);
return (
@@ -84,6 +89,8 @@ class Stream extends React.Component {
key={comment.id}
reactKey={comment.id}
comment={comment}
+ maxCharCount={maxCharCount}
+ charCountEnable={charCountEnable}
pluginProps={pluginProps}
/>
)
diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css
index 32f30d800..087859e89 100644
--- a/client/coral-embed-stream/style/default.css
+++ b/client/coral-embed-stream/style/default.css
@@ -280,13 +280,13 @@ hr {
.commentActionsRight, .replyActionsRight {
display: flex;
justify-content: flex-end;
- width: 50%;
+ width: 30%;
}
.commentActionsLeft, .replyActionsLeft {
display: flex;
justify-content: flex-start;
float: left;
- width: 50%;
+ width: 70%;
}
.comment__action-container .material-icons {
diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js
index 2a988711d..261c95414 100644
--- a/client/coral-plugin-commentbox/CommentBox.js
+++ b/client/coral-plugin-commentbox/CommentBox.js
@@ -121,11 +121,11 @@ class CommentBox extends Component {
handleChange = e => this.setState({body: e.target.value});
render () {
- const {styles, isReply, authorId, charCount} = this.props;
+ const {styles, isReply, authorId, maxCharCount} = this.props;
let {cancelButtonClicked} = this.props;
const length = this.state.body.length;
- const enablePostComment = !length || (charCount && length > charCount);
+ const enablePostComment = !length || (maxCharCount && length > maxCharCount);
if (isReply && typeof cancelButtonClicked !== 'function') {
console.warn('the CommentBox component should have a cancelButtonClicked callback defined if it lives in a Reply');
@@ -150,8 +150,8 @@ class CommentBox extends Component {
onChange={this.handleChange}
rows={3}/>
- charCount ? `${name}-char-max` : ''}`}>
- {charCount && `${charCount - length} ${lang.t('characters-remaining')}`}
+
maxCharCount ? `${name}-char-max` : ''}`}>
+ {maxCharCount && `${maxCharCount - length} ${lang.t('characters-remaining')}`}
{
* @param {String} status the new status of the comment
*/
-const setCommentStatus = ({loaders: {Comments}}, {id, status}) => {
+const setCommentStatus = ({user, loaders: {Comments}}, {id, status}) => {
return CommentsService
- .setStatus(id, status)
+ .pushStatus(id, status, user ? user.id : null)
.then((comment) => {
// If the loaders are present, clear the caches for these values because we
diff --git a/services/comments.js b/services/comments.js
index 7e9cca20f..d77118705 100644
--- a/services/comments.js
+++ b/services/comments.js
@@ -213,7 +213,15 @@ module.exports = class CommentsService {
* @return {Promise}
*/
static pushStatus(id, status, assigned_by = null) {
- return CommentModel.update({id}, {
+
+ // Check to see if the comment status is in the allowable set of statuses.
+ if (STATUSES.indexOf(status) === -1) {
+
+ // Comment status is not supported! Error out here.
+ return Promise.reject(new Error(`status ${status} is not supported`));
+ }
+
+ return CommentModel.findOneAndUpdate({id}, {
$push: {
status_history: {
type: status,
@@ -292,25 +300,4 @@ module.exports = class CommentsService {
return CommentModel.find(query);
}
-
- /**
- * Sets Comment Status
- * @param {String} id identifier of the comment (uuid)
- * @param {String} status the new status of the comment
- * @return {Promise}
- */
-
- static setStatus(id, status) {
-
- // Check to see if the comment status is in the allowable set of statuses.
- if (STATUSES.indexOf(status) === -1) {
-
- // Comment status is not supported! Error out here.
- return Promise.reject(new Error(`status ${status} is not supported`));
- }
-
- return CommentModel.findOneAndUpdate({id}, {
- $set: {status}
- });
- }
};