Adding banned word notification on post.

This commit is contained in:
David Jay
2016-12-01 21:32:08 -05:00
parent 2cb439ccf8
commit b5b0cd9b12
4 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -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;
});
};
}
+4 -2
View File
@@ -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);
@@ -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!"
}
}
@@ -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: {