Node.js based forum software built for the modern web
feat: undo for posts move
Julian Lam762e9fe88c2a
diff --git a/public/language/en-GB/topic.json b/public/language/en-GB/topic.jsonindex 10f1f717ff..8292feb461 100644--- a/public/language/en-GB/topic.json+++ b/public/language/en-GB/topic.json@@ -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?",diff --git a/public/src/client/topic/move-post.js b/public/src/client/topic/move-post.jsindex 1b9e08bec9..029891c8ca 100644--- a/public/src/client/topic/move-post.js+++ b/public/src/client/topic/move-post.js@@ -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');+ },+ });});});};