mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
fix post delete state after more posts are loaded
This commit is contained in:
@@ -17,6 +17,17 @@ define(function() {
|
|||||||
google_url = templates.get('google-share-url');
|
google_url = templates.get('google-share-url');
|
||||||
|
|
||||||
|
|
||||||
|
function fixDeleteStateForPosts() {
|
||||||
|
var postEls = document.querySelectorAll('#post-container li[data-deleted]');
|
||||||
|
for (var x = 0, numPosts = postEls.length; x < numPosts; x++) {
|
||||||
|
if (postEls[x].getAttribute('data-deleted') === '1') {
|
||||||
|
toggle_post_delete_state(postEls[x].getAttribute('data-pid'));
|
||||||
|
}
|
||||||
|
postEls[x].removeAttribute('data-deleted');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
jQuery('document').ready(function() {
|
jQuery('document').ready(function() {
|
||||||
|
|
||||||
app.addCommasToNumbers();
|
app.addCommasToNumbers();
|
||||||
@@ -182,12 +193,8 @@ define(function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix delete state for this thread's posts
|
fixDeleteStateForPosts();
|
||||||
var postEls = document.querySelectorAll('#post-container li[data-deleted]');
|
|
||||||
for (var x = 0, numPosts = postEls.length; x < numPosts; x++) {
|
|
||||||
if (postEls[x].getAttribute('data-deleted') === '1') toggle_post_delete_state(postEls[x].getAttribute('data-pid'));
|
|
||||||
postEls[x].removeAttribute('data-deleted');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Follow Thread State
|
// Follow Thread State
|
||||||
var followEl = $('.main-post .follow'),
|
var followEl = $('.main-post .follow'),
|
||||||
@@ -259,7 +266,9 @@ define(function() {
|
|||||||
var bottom = ($(document).height() - $(window).height()) * 0.9;
|
var bottom = ($(document).height() - $(window).height()) * 0.9;
|
||||||
|
|
||||||
if ($(window).scrollTop() > bottom && !app.infiniteLoaderActive && $('#post-container').children().length) {
|
if ($(window).scrollTop() > bottom && !app.infiniteLoaderActive && $('#post-container').children().length) {
|
||||||
app.loadMorePosts(tid);
|
app.loadMorePosts(tid, function(posts) {
|
||||||
|
fixDeleteStateForPosts();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user