mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: allow undo of topic move
This commit is contained in:
@@ -93,7 +93,8 @@
|
||||
"thread_tools.merge_topics": "Merge Topics",
|
||||
"thread_tools.merge": "Merge",
|
||||
|
||||
"topic_move_success": "This topic has been successfully moved to %1",
|
||||
"topic_move_success": "This topic has been successfully moved to %1. Click here to undo.",
|
||||
"topic_move_undone": "Topic 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?",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
define('forum/topic/move', ['categorySelector'], function (categorySelector) {
|
||||
define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySelector, alerts) {
|
||||
var Move = {};
|
||||
var modal;
|
||||
var selectedCategory;
|
||||
@@ -58,7 +58,22 @@ define('forum/topic/move', ['categorySelector'], function (categorySelector) {
|
||||
if (!commitEl.prop('disabled') && selectedCategory && selectedCategory.cid) {
|
||||
commitEl.prop('disabled', true);
|
||||
|
||||
modal.modal('hide');
|
||||
|
||||
alerts.alert({
|
||||
alert_id: 'tids_move_' + Move.tids.join(';'),
|
||||
title: '[[topic:thread_tools.move]]',
|
||||
message: '[[topic:topic_move_success, ' + selectedCategory.name + ']]',
|
||||
type: 'success',
|
||||
timeout: 5000,
|
||||
timeoutfn: function () {
|
||||
moveTopics();
|
||||
},
|
||||
clickfn: function (alert, params) {
|
||||
delete params.timeoutfn;
|
||||
app.alertSuccess('[[topic:topic_move_undone]]');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +87,6 @@ define('forum/topic/move', ['categorySelector'], function (categorySelector) {
|
||||
$(window).trigger('action:topic.move', data);
|
||||
|
||||
socket.emit(Move.moveAll ? 'topics.moveAll' : 'topics.move', data, function (err) {
|
||||
modal.modal('hide');
|
||||
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user