diff --git a/packages/frontend/src/main/components/comments/CommentThreadViewer.vue b/packages/frontend/src/main/components/comments/CommentThreadViewer.vue index 4c12e048f..a35f71b20 100644 --- a/packages/frontend/src/main/components/comments/CommentThreadViewer.vue +++ b/packages/frontend/src/main/components/comments/CommentThreadViewer.vue @@ -57,15 +57,36 @@ @keydown.enter.shift.exact.prevent="addReply()" > Archive + + + + + mdi-pencil + + Archive Comment Thread + + mdi-close + + + This comment thread will be archived. Are you sure? + + + + Cancel + Archive + + + @@ -143,7 +164,8 @@ export default { return { replyText: null, localReplies: [], - minimise: false + minimise: false, + showArchiveDialog: false } }, computed: { @@ -204,6 +226,32 @@ export default { setTimeout(() => { this.$emit('refresh-layout') // needed for layout reshuffle in parent }, 100) + }, + async archiveComment() { + // TODO + try { + await this.$apollo.mutate({ + mutation: gql` + mutation commentArchival($streamId: String!, $commentId: String!) { + commentArchival(streamId: $streamId, commentId: $commentId) + } + `, + variables: { + streamId: this.$route.params.streamId, + commentId: this.comment.id + } + }) + this.replyText = null + this.showArchiveDialog = false + this.$emit('deleted', this.comment) + this.$eventHub.$emit('notification', { + text: 'Thread archived.' + }) + } catch (e) { + this.$eventHub.$emit('notification', { + text: e.message + }) + } } } } diff --git a/packages/frontend/src/main/components/viewer/CommentsOverlay.vue b/packages/frontend/src/main/components/viewer/CommentsOverlay.vue index cd6802b66..7675337e8 100644 --- a/packages/frontend/src/main/components/viewer/CommentsOverlay.vue +++ b/packages/frontend/src/main/components/viewer/CommentsOverlay.vue @@ -69,6 +69,7 @@ @bounce="bounceComment" @refresh-layout="updateCommentBubbles()" @close="collapseComment" + @deleted="handleDeletion" /> @@ -266,6 +267,10 @@ export default { window.__viewer.sectionBox.off() } }, + handleDeletion(comment) { + this.collapseComment(comment) + this.localComments = this.localComments.filter((c) => c.id !== comment.id) + }, updateCommentBubbles() { if (!this.comments) return let cam = window.__viewer.cameraHandler.camera