[common] Fix bug 48484

This commit is contained in:
JuliaSvinareva 2021-06-09 17:17:42 +03:00
parent 7b3c27c619
commit 5c63e5cb0e
3 changed files with 8 additions and 4 deletions

View file

@ -101,6 +101,9 @@ class CommentsController extends Component {
}
removeComment (id) {
this.storeComments.removeComment(id);
if (this.storeComments.showComments.length < 1) {
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
}
}
removeComments (data) {
for (let i = 0; i < data.length; i++) {
@ -481,8 +484,6 @@ class ViewCommentsController extends Component {
}
deleteComment (comment) {
const api = Common.EditorApi.get();
this.props.storeComments.removeShowComment(comment.uid);
comment && api.asc_removeComment(comment.uid);
}
deleteReply (comment, reply) {

View file

@ -61,6 +61,7 @@ export class storeComments {
if (index !== -1) {
collection.splice(index, 1);
}
this.removeShowComment(id);
}
changeComment (id, changeComment) {

View file

@ -759,7 +759,7 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
};
const onViewNextComment = () => {
if (currentIndex + 1 === comments.length) {
if (currentIndex + 1 >= comments.length) {
setCurrentIndex(0);
} else {
setCurrentIndex(currentIndex + 1);
@ -767,7 +767,9 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
};
if(!comment) {
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
if (comments.length > 0) {
onViewNextComment();
}
return null;
}