Comments: Unbind event before binding

Prevents flashing of comments when posting
This commit is contained in:
Pablo Vazquez 2017-11-08 20:29:45 +01:00
parent c6a138ff43
commit e01f915abf

View File

@ -100,8 +100,12 @@ script.
});
{% if show_comments %}
$('body').on('pillar:comment-posted', function(e, comment_node_id) {
$('body')
.off('pillar:comment-posted')
.on('pillar:comment-posted', function(e, comment_node_id) {
var commentsUrl = "{{ url_for('nodes.comments_for_node', node_id=node_id) }}";
loadComments(commentsUrl)
.done(function() {
$('#' + comment_node_id).scrollHere();