Fixes bug where hitting cancel didn't contain the old behaviour (opening the reply dialogue anyway), and instead just plain did nothing.
v1.18.x
Julian Lam 9 years ago
parent 0b6d92ea3e
commit 8b3f1684f7

@ -135,10 +135,9 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
}
function onReplyClicked(button, tid, topicName) {
if (ajaxify.data.lastposttime < (Date.now() - (1000*60*60*24*config.topicStaleDays))) {
return showStaleWarning();
}
showStaleWarning(function(proceed) {
console.log('proceed is', proceed);
if (!proceed) {
var selectionText = '',
selection = window.getSelection ? window.getSelection() : document.selection.createRange();
@ -172,12 +171,12 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
});
}
}
function onQuoteClicked(button, tid, topicName) {
if (ajaxify.data.lastposttime < (Date.now() - (1000*60*60*24*config.topicStaleDays))) {
return showStaleWarning();
});
}
function onQuoteClicked(button, tid, topicName) {
showStaleWarning(function(proceed) {
if (!proceed) {
var username = getUserName(button),
pid = getData(button, 'data-pid');
@ -197,6 +196,8 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
});
});
}
});
}
function favouritePost(button, pid) {
var method = button.attr('data-favourited') === 'false' ? 'posts.favourite' : 'posts.unfavourite';
@ -387,16 +388,23 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
return false;
}
function showStaleWarning() {
function showStaleWarning(callback) {
if (ajaxify.data.lastposttime < (Date.now() - (1000*60*60*24*config.topicStaleDays))) {
translator.translate('[[topic:stale_topic_warning]]', function(translated) {
bootbox.confirm(translated, function(create) {
if (create) {
$(window).trigger('action:composer.topic.new', {
cid: ajaxify.data.cid
});
}
callback(create);
});
});
} else {
callback(false);
}
}
return PostTools;

Loading…
Cancel
Save