mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Avoiding new comment button when a comment is posted.
This commit is contained in:
@@ -134,6 +134,8 @@ class Embed extends Component {
|
||||
postItem={this.props.postItem}
|
||||
appendItemArray={this.props.appendItemArray}
|
||||
updateItem={this.props.updateItem}
|
||||
updateCountCache={this.props.updateCountCache}
|
||||
countCache={countCache[asset.id]}
|
||||
assetId={asset.id}
|
||||
premod={asset.settings.moderation}
|
||||
isReply={false}
|
||||
|
||||
@@ -29,6 +29,8 @@ class CommentBox extends Component {
|
||||
commentPostedHandler,
|
||||
postItem,
|
||||
assetId,
|
||||
updateCountCache,
|
||||
countCache,
|
||||
parentId,
|
||||
addNotification,
|
||||
authorId
|
||||
@@ -44,14 +46,17 @@ class CommentBox extends Component {
|
||||
if (this.props.charCount && this.state.body.length > this.props.charCount) {
|
||||
return;
|
||||
}
|
||||
updateCountCache(assetId, countCache + 1);
|
||||
postItem(comment, 'comments')
|
||||
.then(({data}) => {
|
||||
const postedComment = data.createComment.comment;
|
||||
|
||||
if (postedComment.status === 'REJECTED') {
|
||||
addNotification('error', lang.t('comment-post-banned-word'));
|
||||
updateCountCache(assetId, countCache);
|
||||
} else if (postedComment.status === 'PREMOD') {
|
||||
addNotification('success', lang.t('comment-post-notif-premod'));
|
||||
updateCountCache(assetId, countCache);
|
||||
} else {
|
||||
addNotification('success', 'Your comment has been posted.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user