mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
Adding banned word notification on post.
This commit is contained in:
@@ -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;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user