diff --git a/client/coral-framework/actions/items.js b/client/coral-framework/actions/items.js index 2029714c7..d7d482991 100644 --- a/client/coral-framework/actions/items.js +++ b/client/coral-framework/actions/items.js @@ -197,7 +197,7 @@ export function postItem (item, type, id) { return coralApi(`/${type}`, {method: 'POST', body: item}) .then((json) => { dispatch(addItem({...item, id:json.id}, type)); - return json.id; + return json; }); }; } diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 9ae524652..b2cc48381 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -41,8 +41,10 @@ class CommentBox extends Component { } updateItem(child_id || parent_id, 'showReply', false, 'comments'); postItem(comment, 'comments') - .then((comment_id) => { - if (premod === 'pre') { + .then(({comment_id, status}) => { + if (status === 'rejected') { + addNotification('error', lang.t('comment-post-banned-word')); + } else if (premod === 'pre') { addNotification('success', lang.t('comment-post-notif-premod')); } else { appendItemArray(parent_id || id, related, comment_id, !parent_id, parent_type); diff --git a/client/coral-plugin-commentbox/translations.json b/client/coral-plugin-commentbox/translations.json index 29f3212b9..2211cbbca 100644 --- a/client/coral-plugin-commentbox/translations.json +++ b/client/coral-plugin-commentbox/translations.json @@ -5,7 +5,8 @@ "comment": "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." + "comment-post-notif-premod": "Thank you for posting. Our moderation team will review your comment shortly.", + "comment-post-banned-word": "Your comment contains one or more words which we do not allow. It has been sent to the moderation team for review." }, "es": { "post": "Publicar", @@ -13,6 +14,7 @@ "comment": "Comentario", "name": "Nombre", "comment-post-notif": "¡traduceme!", - "comment-post-notif-premod": "¡traduceme!" + "comment-post-notif-premod": "¡traduceme!", + "comment-post-banned-word": "¡traduceme!" } } diff --git a/tests/client/coral-framework/store/itemActions.spec.js b/tests/client/coral-framework/store/itemActions.spec.js index 45c41025f..6a9b2aeb2 100644 --- a/tests/client/coral-framework/store/itemActions.spec.js +++ b/tests/client/coral-framework/store/itemActions.spec.js @@ -131,7 +131,7 @@ describe('itemActions', () => { body: JSON.stringify(item.data) } ); - expect(id).to.equal('123'); + expect(id).to.deep.equal({id: '123'}); expect(store.getActions()[0]).to.deep.equal({ type: actions.ADD_ITEM, item: {