diff --git a/public/src/client/topic/diffs.js b/public/src/client/topic/diffs.js index 2eccd21191..1eda09efb9 100644 --- a/public/src/client/topic/diffs.js +++ b/public/src/client/topic/diffs.js @@ -44,7 +44,7 @@ define('forum/topic/diffs', ['forum/topic/images', 'benchpress', 'translator'], selectEl.on('change', function () { Diffs.load(pid, this.value, postContainer); - revertEl.prop('disabled', data.timestamps.indexOf(this.value) === -1); + revertEl.prop('disabled', data.timestamps.indexOf(this.value) === 0); }); revertEl.on('click', function () { diff --git a/src/posts/diffs.js b/src/posts/diffs.js index 54999c41b4..f1635a4da4 100644 --- a/src/posts/diffs.js +++ b/src/posts/diffs.js @@ -24,7 +24,7 @@ module.exports = function (Posts) { Diffs.get = async function (pid, since) { const timestamps = await Diffs.list(pid); // Pass those made after `since`, and create keys - const keys = timestamps.filter(t => (parseInt(t, 10) || 0) >= since) + const keys = timestamps.filter(t => (parseInt(t, 10) || 0) > since) .map(t => 'diff:' + pid + '.' + t); return await db.getObjects(keys); }; diff --git a/src/socket.io/posts/diffs.js b/src/socket.io/posts/diffs.js index 837ea4b653..dc69063f14 100644 --- a/src/socket.io/posts/diffs.js +++ b/src/socket.io/posts/diffs.js @@ -10,7 +10,8 @@ module.exports = function (SocketPosts) { const timestamps = await posts.diffs.list(data.pid); const cid = await posts.getCidByPid(data.pid); const canEdit = await privileges.categories.can('edit', cid, socket.uid); - timestamps.unshift(Date.now()); + const postTime = await posts.getPostField(data.pid, 'timestamp'); + timestamps.push(postTime); return { timestamps: timestamps, editable: canEdit,