mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Delete comments using websocket help
This commit is contained in:
		@@ -214,10 +214,6 @@ const CommentsUI = {
 | 
			
		||||
							ComunicWeb.common.notificationSystem.showNotification(lang("comments_ui_err_delete_comment"), "danger");
 | 
			
		||||
							return;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						//Delete the comment node
 | 
			
		||||
						emptyElem(commentContainer);
 | 
			
		||||
						commentContainer.remove();
 | 
			
		||||
					});
 | 
			
		||||
 | 
			
		||||
				});
 | 
			
		||||
@@ -326,4 +322,16 @@ document.addEventListener("commentUpdated", async (e) => {
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	CommentsUI._show_comment(comment, await userInfo(comment.userID), target)	
 | 
			
		||||
})
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
// Register to comments deletion events
 | 
			
		||||
document.addEventListener("commentDeleted", async (e) => {
 | 
			
		||||
	const commentID = e.detail;
 | 
			
		||||
 | 
			
		||||
	const target = document.querySelector("[data-comment-id='"+commentID+"']");
 | 
			
		||||
 | 
			
		||||
	if(target == null)
 | 
			
		||||
		return;
 | 
			
		||||
	
 | 
			
		||||
	target.remove();
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user