[common] Fig Bug 48484

This commit is contained in:
SergeyEzhin 2021-06-08 16:59:11 +03:00
parent 47a4436d06
commit 55de02cb15
3 changed files with 85 additions and 69 deletions

View file

@ -481,7 +481,8 @@ class ViewCommentsController extends Component {
}
deleteComment (comment) {
const api = Common.EditorApi.get();
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
this.props.storeComments.removeShowComment(comment.uid);
comment && api.asc_removeComment(comment.uid);
}
deleteReply (comment, reply) {

View file

@ -39,6 +39,16 @@ export class storeComments {
});
}
removeShowComment(id) {
const index = this.showComments.findIndex((comment) => {
return comment.uid === id;
});
if (index !== -1) {
this.showComments.splice(index, 1);
}
}
addComment (comment) {
comment.groupName ? this.groupCollectionComments.push(comment) : this.collectionComments.push(comment);
}

View file

@ -740,7 +740,6 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
const isAndroid = Device.android;
const viewMode = !storeAppOptions.canComments;
const comments = storeComments.showComments;
const [currentIndex, setCurrentIndex] = useState(0);
@ -767,6 +766,11 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
}
};
if(!comment) {
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
return null;
}
return (
<Fragment>
<Toolbar position='bottom'>
@ -850,6 +854,7 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
</div>
</Fragment>
)
}));
const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment}) => {