mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Register to comments updateds events
This commit is contained in:
parent
0344ca5ca9
commit
96ed7a47b8
@ -202,6 +202,10 @@ class UserWebSocket {
|
|||||||
SendEvent("new_comment", msg.data);
|
SendEvent("new_comment", msg.data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "comment_updated":
|
||||||
|
SendEvent("commentUpdated", msg.data);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.error("WS Unspported kind of message!", msg);
|
console.error("WS Unspported kind of message!", msg);
|
||||||
break;
|
break;
|
||||||
|
@ -29,10 +29,6 @@ ComunicWeb.components.comments.editor = {
|
|||||||
ComunicWeb.common.notificationSystem.showNotification(lang("comments_editor_err_update"), "danger");
|
ComunicWeb.common.notificationSystem.showNotification(lang("comments_editor_err_update"), "danger");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Else perform next actions
|
|
||||||
//Reload the comment
|
|
||||||
ComunicWeb.components.comments.actions.reload(infos.ID, root);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,9 @@ const CommentsUI = {
|
|||||||
emptyElem(target);
|
emptyElem(target);
|
||||||
var commentContainer = target;
|
var commentContainer = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save comment ID for later use
|
||||||
|
commentContainer.setAttribute("data-comment-id", infos.ID)
|
||||||
|
|
||||||
|
|
||||||
//Add user image
|
//Add user image
|
||||||
@ -312,4 +315,15 @@ document.addEventListener("new_comment", async (e) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
CommentsUI._show_comment(comment, await userInfo(comment.userID), newCommentTarget)
|
CommentsUI._show_comment(comment, await userInfo(comment.userID), newCommentTarget)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Register to comments updates events
|
||||||
|
document.addEventListener("commentUpdated", async (e) => {
|
||||||
|
const comment = e.detail;
|
||||||
|
const target = document.querySelector("[data-comment-id='"+comment.ID+"']");
|
||||||
|
|
||||||
|
if(target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CommentsUI._show_comment(comment, await userInfo(comment.userID), target)
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user