]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/page-comment.ts
Comments: Started archive display, created mode for tree node
[bookstack] / resources / js / components / page-comment.ts
index d2cbd21d1db89810fbd95255b8efd78b6ee3f9fa..82cb95f13de027f6b869f50581e2bd7e7a7a4707 100644 (file)
@@ -137,10 +137,12 @@ export class PageComment extends Component {
     protected async archive(): Promise<void> {
         this.showLoading();
         const isArchived = this.archiveButton.dataset.isArchived === 'true';
+        const action = isArchived ? 'unarchive' : 'archive';
 
-        await window.$http.put(`/comment/${this.commentId}/${isArchived ? 'unarchive' : 'archive'}`);
-        this.$emit('archive');
+        const response = await window.$http.put(`/comment/${this.commentId}/${action}`);
+        this.$emit(action, {new_thread_dom: htmlToDom(response.data as string)});
         window.$events.success(this.archiveText);
+        this.container.closest('.comment-branch')?.remove();
     }
 
     protected showLoading(): HTMLElement {