diff --git a/apps/common/mobile/lib/controller/collaboration/Comments.jsx b/apps/common/mobile/lib/controller/collaboration/Comments.jsx index f0d773903..4d476b7aa 100644 --- a/apps/common/mobile/lib/controller/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Comments.jsx @@ -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) { diff --git a/apps/common/mobile/lib/store/comments.js b/apps/common/mobile/lib/store/comments.js index 86248d9d2..49cf46fe4 100644 --- a/apps/common/mobile/lib/store/comments.js +++ b/apps/common/mobile/lib/store/comments.js @@ -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); } diff --git a/apps/common/mobile/lib/view/collaboration/Comments.jsx b/apps/common/mobile/lib/view/collaboration/Comments.jsx index 169b310a8..5c73e2e59 100644 --- a/apps/common/mobile/lib/view/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/view/collaboration/Comments.jsx @@ -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 ( @@ -779,77 +783,78 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
- - - -
-
- {isAndroid &&
{comment.userInitials}
} -
-
{comment.userName}
-
{comment.date}
-
-
- {!viewMode && -
-
{onResolveComment(comment);}}>
-
{openActionComment(true);}} - >
-
- } -
-
- {comment.quote &&
{sliceQuote(comment.quote)}
} -
{pickLink(comment.comment)}
- {comment.replies.length > 0 && -
    - {comment.replies.map((reply, indexReply) => { - return ( -
  • -
    -
    -
    -
    -
    - {isAndroid &&
    {reply.userInitials}
    } -
    -
    {reply.userName}
    -
    {reply.date}
    -
    -
    - {!viewMode && -
    -
    {setReply(reply); openActionReply(true);}} - > - -
    -
    - } -
    -
    -
    {pickLink(reply.reply)}
    -
    -
    -
    + + + +
    +
    + {isAndroid &&
    {comment.userInitials}
    } +
    +
    {comment.userName}
    +
    {comment.date}
    -
  • - ) - })} -
- } -
-
-
- - -
+
+ {!viewMode && +
+
{onResolveComment(comment);}}>
+
{openActionComment(true);}} + >
+
+ } + +
+ {comment.quote &&
{sliceQuote(comment.quote)}
} +
{pickLink(comment.comment)}
+ {comment.replies.length > 0 && + + } +
+ + + + +
) + })); const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment}) => {