fix accidental client-side invocation of post history controls if it was disabled via ACP

v1.18.x
Julian Lam 7 years ago
parent d949aeed49
commit f9f75c6b43

@ -4,6 +4,10 @@ define('forum/topic/diffs', ['forum/topic/images', 'benchpress', 'translator'],
var Diffs = {};
Diffs.open = function (pid) {
if (!config.enablePostHistory) {
return;
}
var localeStringOpts = { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' };
socket.emit('posts.getDiffs', { pid: pid }, function (err, timestamps) {
@ -49,6 +53,10 @@ define('forum/topic/diffs', ['forum/topic/images', 'benchpress', 'translator'],
};
Diffs.load = function (pid, since, postContainer) {
if (!config.enablePostHistory) {
return;
}
socket.emit('posts.showPostAt', { pid: pid, since: since }, function (err, data) {
if (err) {
return app.alertError(err.message);

@ -140,10 +140,12 @@ define('forum/topic/postTools', [
}
});
postContainer.on('click', '[component="post/view-history"], [component="post/edit-indicator"]', function () {
var btn = $(this);
diffs.open(getData(btn, 'data-pid'));
});
if (config.enablePostHistory) {
postContainer.on('click', '[component="post/view-history"], [component="post/edit-indicator"]', function () {
var btn = $(this);
diffs.open(getData(btn, 'data-pid'));
});
}
postContainer.on('click', '[component="post/delete"]', function () {
var btn = $(this);

Loading…
Cancel
Save