mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-03 14:20:33 +01:00
Merge branch 'master' into develop
This commit is contained in:
33
CHANGELOG.md
33
CHANGELOG.md
@@ -1,3 +1,36 @@
|
||||
#### v3.3.3 (2023-08-19)
|
||||
|
||||
##### Chores
|
||||
|
||||
* incrementing version number - v3.3.2 (ec9dac97)
|
||||
* update changelog for v3.3.2 (2ecf15c4)
|
||||
* incrementing version number - v3.3.1 (151cc68f)
|
||||
* incrementing version number - v3.3.0 (fc1ad70f)
|
||||
* incrementing version number - v3.2.3 (b06d3e63)
|
||||
* incrementing version number - v3.2.2 (758ecfcd)
|
||||
* incrementing version number - v3.2.1 (20145074)
|
||||
* incrementing version number - v3.2.0 (9ecac38e)
|
||||
* incrementing version number - v3.1.7 (0b4e81ab)
|
||||
* incrementing version number - v3.1.6 (b3a3b130)
|
||||
* incrementing version number - v3.1.5 (ec19343a)
|
||||
* incrementing version number - v3.1.4 (2452783c)
|
||||
* incrementing version number - v3.1.3 (3b4e9d3f)
|
||||
* incrementing version number - v3.1.2 (40fa3489)
|
||||
* incrementing version number - v3.1.1 (40250733)
|
||||
* incrementing version number - v3.1.0 (0cb386bd)
|
||||
* incrementing version number - v3.0.1 (26f6ea49)
|
||||
* incrementing version number - v3.0.0 (224e08cd)
|
||||
|
||||
##### Bug Fixes
|
||||
|
||||
* one more fix (51587ca3)
|
||||
* one more upgrade script fix (b5d1e917)
|
||||
* post preview on skins remove clearfix and floats (5a8e6af4)
|
||||
|
||||
##### Refactors
|
||||
|
||||
* add connectionTimeout to psql (90f29571)
|
||||
|
||||
#### v3.3.2 (2023-08-18)
|
||||
|
||||
##### Chores
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "nodebb",
|
||||
"license": "GPL-3.0",
|
||||
"description": "NodeBB Forum",
|
||||
"version": "3.3.2",
|
||||
"version": "3.3.3",
|
||||
"homepage": "https://www.nodebb.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -11,36 +11,36 @@ module.exports = {
|
||||
method: async function () {
|
||||
const { progress } = this;
|
||||
|
||||
progress.total = await db.sortedSetCard(`chat:rooms`);
|
||||
await batch.processSortedSet(`chat:rooms`, async (roomIds) => {
|
||||
progress.incr(roomIds.length);
|
||||
for (const roomId of roomIds) {
|
||||
await batch.processSortedSet(`chat:room:${roomId}:mids`, async (mids) => {
|
||||
let messageData = await db.getObjects(mids.map(mid => `message:${mid}`));
|
||||
messageData.forEach((m, idx) => {
|
||||
if (m) {
|
||||
m.mid = parseInt(mids[idx], 10);
|
||||
}
|
||||
});
|
||||
messageData = messageData.filter(Boolean);
|
||||
const allRoomIds = await db.getSortedSetRange(`chat:rooms`, 0, -1);
|
||||
|
||||
const bulkSet = messageData.map(
|
||||
msg => [`message:${msg.mid}`, { mid: msg.mid }]
|
||||
);
|
||||
progress.total = allRoomIds.length;
|
||||
|
||||
await db.setObjectBulk(bulkSet);
|
||||
await db.sortedSetAdd(
|
||||
'messages:mid',
|
||||
messageData.map(msg => msg.timestamp),
|
||||
messageData.map(msg => msg.mid)
|
||||
);
|
||||
}, {
|
||||
batch: 500,
|
||||
for (const roomId of allRoomIds) {
|
||||
await batch.processSortedSet(`chat:room:${roomId}:mids`, async (mids) => {
|
||||
let messageData = await db.getObjects(mids.map(mid => `message:${mid}`));
|
||||
messageData.forEach((m, idx) => {
|
||||
if (m) {
|
||||
m.mid = parseInt(mids[idx], 10);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
batch: 500,
|
||||
});
|
||||
messageData = messageData.filter(Boolean);
|
||||
|
||||
const bulkSet = messageData.map(
|
||||
msg => [`message:${msg.mid}`, { mid: msg.mid }]
|
||||
);
|
||||
|
||||
await db.setObjectBulk(bulkSet);
|
||||
await db.sortedSetAdd(
|
||||
'messages:mid',
|
||||
messageData.map(msg => msg.timestamp),
|
||||
messageData.map(msg => msg.mid)
|
||||
);
|
||||
}, {
|
||||
batch: 500,
|
||||
});
|
||||
progress.incr(1);
|
||||
}
|
||||
|
||||
const count = await db.sortedSetCard(`messages:mid`);
|
||||
await db.setObjectField('global', 'messageCount', count);
|
||||
},
|
||||
|
||||
@@ -38,47 +38,44 @@ module.exports = {
|
||||
if (roomData) {
|
||||
const midsSeen = {};
|
||||
const { roomId } = roomData;
|
||||
await batch.processSortedSet(`chat:room:${roomId}:uids`, async (uids) => {
|
||||
for (const uid of uids) {
|
||||
await batch.processSortedSet(`uid:${uid}:chat:room:${roomId}:mids`, async (mids) => {
|
||||
const uniqMids = mids.filter(mid => !midsSeen.hasOwnProperty(mid));
|
||||
if (!uniqMids.length) {
|
||||
return;
|
||||
const uids = await db.getSortedSetRange(`chat:room:${roomId}:uids`, 0, -1);
|
||||
for (const uid of uids) {
|
||||
await batch.processSortedSet(`uid:${uid}:chat:room:${roomId}:mids`, async (mids) => {
|
||||
const uniqMids = mids.filter(mid => !midsSeen.hasOwnProperty(mid));
|
||||
if (!uniqMids.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
let messageData = await db.getObjects(uniqMids.map(mid => `message:${mid}`));
|
||||
messageData.forEach((m, idx) => {
|
||||
if (m) {
|
||||
m.mid = parseInt(uniqMids[idx], 10);
|
||||
}
|
||||
|
||||
let messageData = await db.getObjects(uniqMids.map(mid => `message:${mid}`));
|
||||
messageData.forEach((m, idx) => {
|
||||
if (m) {
|
||||
m.mid = parseInt(uniqMids[idx], 10);
|
||||
}
|
||||
});
|
||||
messageData = messageData.filter(Boolean);
|
||||
|
||||
const bulkSet = messageData.map(
|
||||
msg => [`message:${msg.mid}`, { roomId: roomId }]
|
||||
);
|
||||
|
||||
await db.setObjectBulk(bulkSet);
|
||||
await db.sortedSetAdd(
|
||||
`chat:room:${roomId}:mids`,
|
||||
messageData.map(m => m.timestamp),
|
||||
messageData.map(m => m.mid),
|
||||
);
|
||||
uniqMids.forEach((mid) => {
|
||||
midsSeen[mid] = 1;
|
||||
});
|
||||
}, {
|
||||
batch: 500,
|
||||
});
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await db.deleteAll(`uid:${uid}:chat:room:${roomId}:mids`);
|
||||
}
|
||||
progress.incr(uids.length);
|
||||
}, {
|
||||
batch: 500,
|
||||
});
|
||||
const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);
|
||||
await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);
|
||||
messageData = messageData.filter(Boolean);
|
||||
|
||||
const bulkSet = messageData.map(
|
||||
msg => [`message:${msg.mid}`, { roomId: roomId }]
|
||||
);
|
||||
|
||||
await db.setObjectBulk(bulkSet);
|
||||
await db.sortedSetAdd(
|
||||
`chat:room:${roomId}:mids`,
|
||||
messageData.map(m => m.timestamp),
|
||||
messageData.map(m => m.mid),
|
||||
);
|
||||
uniqMids.forEach((mid) => {
|
||||
midsSeen[mid] = 1;
|
||||
});
|
||||
}, {
|
||||
batch: 500,
|
||||
});
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await db.deleteAll(`uid:${uid}:chat:room:${roomId}:mids`);
|
||||
progress.incr(1);
|
||||
}
|
||||
|
||||
await db.setObjectField(`chat:room:${roomId}`, 'userCount', uids.length);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
||||
Reference in New Issue
Block a user