mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: make upload scores descending for ordering
This commit is contained in:
@@ -163,7 +163,7 @@ module.exports = function (Posts) {
|
||||
filePaths = await _filterValidPaths(filePaths); // Only process files that exist and are within uploads directory
|
||||
|
||||
const now = Date.now();
|
||||
const scores = filePaths.map(() => now);
|
||||
const scores = filePaths.map((p, i) => now + i);
|
||||
const bulkAdd = filePaths.map(path => [`upload:${md5(path)}:pids`, now, pid]);
|
||||
await Promise.all([
|
||||
db.sortedSetAdd(`post:${pid}:uploads`, scores, filePaths),
|
||||
|
||||
Reference in New Issue
Block a user