Skip to content

Commit

Permalink
fix: accept/reject in post-queue instead of accept/delete
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Aug 28, 2020
1 parent e449ff9 commit 694f4b2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions public/src/client/post-queue.js
Expand Up @@ -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;
});
Expand Down

0 comments on commit 694f4b2

Please sign in to comment.