feat: undo for posts move

v1.18.x
Julian Lam 5 years ago
parent 65d94a3b6d
commit 762e9fe88c

@ -91,8 +91,10 @@
"thread_tools.merge_topics": "Merge Topics",
"thread_tools.merge": "Merge",
"topic_move_success": "This topic has been successfully moved to %1. Click here to undo.",
"topic_move_success": "This topic will be moved shortly. Click here to undo.",
"topic_move_undone": "Topic move undone",
"topic_move_posts_success": "Posts will be moved shortly. Click here to undo.",
"topic_move_posts_undone": "Post move undone",
"post_delete_confirm": "Are you sure you want to delete this post?",
"post_restore_confirm": "Are you sure you want to restore this post?",

@ -2,8 +2,8 @@
define('forum/topic/move-post', [
'components', 'postSelect', 'translator',
], function (components, postSelect, translator) {
'components', 'postSelect', 'translator', 'alerts',
], function (components, postSelect, translator, alerts) {
var MovePost = {};
var moveModal;
@ -34,7 +34,23 @@ define('forum/topic/move-post', [
.on('action:ajaxify.end', checkMoveButtonEnable);
moveCommit.on('click', function () {
movePosts();
moveCommit.attr('disabled', true);
alerts.alert({
alert_id: 'pids_move_' + postSelect.pids.join('-'),
title: '[[topic:thread_tools.move-posts]]',
message: '[[topic:topic_move_posts_success]]',
type: 'success',
timeout: 10000,
timeoutfn: function () {
movePosts();
},
clickfn: function (alert, params) {
delete params.timeoutfn;
app.alertSuccess('[[topic:topic_move_posts_undone]]');
moveCommit.removeAttr('disabled');
},
});
});
});
};

Loading…
Cancel
Save