mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #10354, flag actions regression
This commit is contained in:
@@ -83,15 +83,15 @@ define('forum/flags/detail', [
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete-post':
|
case 'delete-post':
|
||||||
postAction('delete', ajaxify.data.target.pid, ajaxify.data.target.tid);
|
postAction('delete', api.del, `/posts/${ajaxify.data.target.pid}/state`);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'purge-post':
|
case 'purge-post':
|
||||||
postAction('purge', ajaxify.data.target.pid, ajaxify.data.target.tid);
|
postAction('purge', api.del, `/posts/${ajaxify.data.target.pid}`);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'restore-post':
|
case 'restore-post':
|
||||||
postAction('restore', ajaxify.data.target.pid, ajaxify.data.target.tid);
|
postAction('restore', api.put, `/posts/${ajaxify.data.target.pid}/state`);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'prepare-edit': {
|
case 'prepare-edit': {
|
||||||
@@ -115,23 +115,14 @@ define('forum/flags/detail', [
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function postAction(action, pid, tid) {
|
function postAction(action, method, path) {
|
||||||
translator.translate('[[topic:post_' + action + '_confirm]]', function (msg) {
|
translator.translate('[[topic:post_' + action + '_confirm]]', function (msg) {
|
||||||
bootbox.confirm(msg, function (confirm) {
|
bootbox.confirm(msg, function (confirm) {
|
||||||
if (!confirm) {
|
if (!confirm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.emit('posts.' + action, {
|
method(path).then(ajaxify.refresh).catch(alerts.error);
|
||||||
pid: pid,
|
|
||||||
tid: tid,
|
|
||||||
}, function (err) {
|
|
||||||
if (err) {
|
|
||||||
alerts.error(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
ajaxify.refresh();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user