feat: make undoTimeout configurable, closes #9599

v1.18.x
psychobunny 4 years ago
parent 93d94564c1
commit 05cc7ccb60

@ -30,6 +30,7 @@
"maximumTagsPerTopic": 5, "maximumTagsPerTopic": 5,
"minimumTagLength": 3, "minimumTagLength": 3,
"maximumTagLength": 15, "maximumTagLength": 15,
"undoTimeout": 10000,
"allowTopicsThumbnail": 1, "allowTopicsThumbnail": 1,
"registrationType": "normal", "registrationType": "normal",
"registrationApprovalType": "normal", "registrationApprovalType": "normal",

@ -40,5 +40,8 @@
"site-colors": "Site Color Metadata", "site-colors": "Site Color Metadata",
"theme-color": "Theme Color", "theme-color": "Theme Color",
"background-color": "Background Color", "background-color": "Background Color",
"background-color-help": "Color used for splash screen background when website is installed as a PWA" "background-color-help": "Color used for splash screen background when website is installed as a PWA",
"undo-timeout": "Undo Timeout",
"undo-timeout-help": "Some operations such as moving topics will allow for the moderator to undo their action within a certain timeframe. Set to 0 to disable undo completely.",
"topic-tools": "Topic Tools"
} }

@ -63,12 +63,13 @@ define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySel
currentCid: Move.currentCid, currentCid: Move.currentCid,
onComplete: Move.onComplete, onComplete: Move.onComplete,
}; };
alerts.alert({ if (config.undoTimeout > 0) {
return alerts.alert({
alert_id: 'tids_move_' + (Move.tids ? Move.tids.join('-') : 'all'), alert_id: 'tids_move_' + (Move.tids ? Move.tids.join('-') : 'all'),
title: '[[topic:thread_tools.move]]', title: '[[topic:thread_tools.move]]',
message: message, message: message,
type: 'success', type: 'success',
timeout: 10000, timeout: config.undoTimeout,
timeoutfn: function () { timeoutfn: function () {
moveTopics(data); moveTopics(data);
}, },
@ -78,6 +79,9 @@ define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySel
}, },
}); });
} }
moveTopics(data);
}
} }
function moveTopics(data) { function moveTopics(data) {

@ -36,6 +36,7 @@ apiController.loadConfig = async function (req) {
maximumTagsPerTopic: meta.config.maximumTagsPerTopic || 5, maximumTagsPerTopic: meta.config.maximumTagsPerTopic || 5,
minimumTagLength: meta.config.minimumTagLength || 3, minimumTagLength: meta.config.minimumTagLength || 3,
maximumTagLength: meta.config.maximumTagLength || 15, maximumTagLength: meta.config.maximumTagLength || 15,
undoTimeout: meta.config.undoTimeout || 0,
useOutgoingLinksPage: meta.config.useOutgoingLinksPage === 1, useOutgoingLinksPage: meta.config.useOutgoingLinksPage === 1,
outgoingLinksWhitelist: meta.config.useOutgoingLinksPage === 1 ? meta.config['outgoingLinks:whitelist'] : undefined, outgoingLinksWhitelist: meta.config.useOutgoingLinksPage === 1 ? meta.config['outgoingLinks:whitelist'] : undefined,
allowGuestHandles: meta.config.allowGuestHandles === 1, allowGuestHandles: meta.config.allowGuestHandles === 1,

@ -189,4 +189,16 @@
</div> </div>
</div> </div>
<div class="row">
<div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/general:topic-tools]]</div>
<div class="col-sm-10 col-xs-12">
<form>
<label>[[admin/settings/general:undo-timeout]]</label>
<input type="text" class="form-control" placeholder="10000" data-field="undoTimeout" />
<p class="help-block">
[[admin/settings/general:undo-timeout-help]]
</p>
</form>
</div>
</div>
<!-- IMPORT admin/partials/settings/footer.tpl --> <!-- IMPORT admin/partials/settings/footer.tpl -->
Loading…
Cancel
Save