Fix posts not being processed by blacklist after post updates

- Blacklisting individual posts was moved into its own function
- Fixed Javascript variables being leaked into the user environment
- Fixed post qTips being orphaned by replacements by destroying them first
- Moved edit form check into post success to avoid repeating post check
This commit is contained in:
BrokenEagle
2020-03-06 21:56:04 +00:00
parent 1a2c082b86
commit d84150b232
2 changed files with 28 additions and 22 deletions

View File

@@ -118,24 +118,28 @@ Blacklist.apply = function() {
var count = 0
$.each(this.posts(), function(i, post) {
var post_count = 0;
$.each(Blacklist.entries, function(j, entry) {
if (Blacklist.post_match(post, entry)) {
entry.hits += 1;
count += 1;
post_count += 1;
}
});
if (post_count > 0) {
Blacklist.post_hide(post);
} else {
Blacklist.post_unhide(post);
}
count += Blacklist.apply_post(post);
});
return count;
}
Blacklist.apply_post = function(post) {
var post_count = 0;
$.each(Blacklist.entries, function(j, entry) {
if (Blacklist.post_match(post, entry)) {
entry.hits += 1;
post_count += 1;
}
});
if (post_count > 0) {
Blacklist.post_hide(post);
} else {
Blacklist.post_unhide(post);
}
return post_count;
};
Blacklist.posts = function() {
return $(".post-preview, #image-container, #c-comments .post, .mod-queue-preview.post-preview");
}