Node.js based forum software built for the modern web
showing history state in post tools load
Julian Lamc1fef4561bd2
diff --git a/src/posts/diffs.js b/src/posts/diffs.jsindex 60e9510f92..869cd25298 100644--- a/src/posts/diffs.js+++ b/src/posts/diffs.js@@ -8,6 +8,12 @@ var diff = require('diff');module.exports = function (Posts) {Posts.diffs = {};+ Posts.diffs.exists = function (pid, callback) {+ db.sortedSetCard('post:' + pid + ':diffs', function (err, numDiffs) {+ return callback(err, numDiffs > 0);+ });+ };+Posts.diffs.list = function (pid, callback) {db.getSortedSetRangeWithScores('post:' + pid + ':diffs', 0, -1, function (err, diffs) {callback(err, diffs ? diffs.map(function (diffObj) {diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.jsindex a61e50ec6c..b8533937ce 100644--- a/src/socket.io/posts/tools.js+++ b/src/socket.io/posts/tools.js@@ -51,6 +51,7 @@ module.exports = function (SocketPosts) {postSharing: function (next) {social.getActivePostSharing(next);},+ history: async.apply(posts.diffs.exists, data.pid),}, next);},function (results, next) {@@ -64,6 +65,7 @@ module.exports = function (SocketPosts) {results.posts.display_moderator_tools = results.posts.display_edit_tools || results.posts.display_delete_tools;results.posts.display_move_tools = results.isAdmin || results.isModerator;results.posts.display_ip_ban = (results.isAdmin || results.isGlobalMod) && !results.posts.selfPost;+ results.posts.display_history = results.history;if (!results.isAdmin && !results.isGlobalMod && !results.isModerator) {results.posts.ip = undefined;