Skip to content

Node.js based forum software built for the modern web

fix: accept/reject in post-queue instead of accept/delete

Julian Lam694f4b2bcf43
diff --git a/public/src/client/post-queue.js b/public/src/client/post-queue.js
index 6bd7490ab1..49c4ccae66 100644
--- a/public/src/client/post-queue.js
+++ b/public/src/client/post-queue.js
@@ -11,13 +11,23 @@ define('forum/post-queue', ['categorySelector'], function (categorySelector) {
var parent = $(this).parents('[data-id]');
var action = $(this).attr('data-action');
var id = parent.attr('data-id');
- var method = action === 'accept' ? 'posts.accept' : 'posts.reject';
+ var listContainer = parent.get(0).parentNode;
- socket.emit(method, { id: id }, function (err) {
+ if (!['accept', 'reject'].some(function (valid) {
+ return action === valid;
+ })) {
+ return;
+ }
+
+ socket.emit('posts.' + action, { id: id }, function (err) {
if (err) {
return app.alertError(err.message);
}
parent.remove();
+
+ if (listContainer.childElementCount === 0) {
+ ajaxify.refresh();
+ }
});
return false;
});