mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
fix: #8410
This commit is contained in:
@@ -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 () {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user