feat: make undoTimeout configurable, closes #9599

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

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

@ -40,5 +40,8 @@
"site-colors": "Site Color Metadata",
"theme-color": "Theme 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,20 +63,24 @@ define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySel
currentCid: Move.currentCid,
onComplete: Move.onComplete,
};
alerts.alert({
alert_id: 'tids_move_' + (Move.tids ? Move.tids.join('-') : 'all'),
title: '[[topic:thread_tools.move]]',
message: message,
type: 'success',
timeout: 10000,
timeoutfn: function () {
moveTopics(data);
},
clickfn: function (alert, params) {
delete params.timeoutfn;
app.alertSuccess('[[topic:topic_move_undone]]');
},
});
if (config.undoTimeout > 0) {
return alerts.alert({
alert_id: 'tids_move_' + (Move.tids ? Move.tids.join('-') : 'all'),
title: '[[topic:thread_tools.move]]',
message: message,
type: 'success',
timeout: config.undoTimeout,
timeoutfn: function () {
moveTopics(data);
},
clickfn: function (alert, params) {
delete params.timeoutfn;
app.alertSuccess('[[topic:topic_move_undone]]');
},
});
}
moveTopics(data);
}
}

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

@ -189,4 +189,16 @@
</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 -->
Loading…
Cancel
Save