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

This commit is contained in:
Julian Lam
2018-04-09 15:59:51 -04:00
parent d949aeed49
commit f9f75c6b43
2 changed files with 14 additions and 4 deletions

View File

@@ -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);

View File

@@ -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);