From 3ec44d640d620cee0a29b3e761f002b310b90cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 10 Jun 2024 11:00:45 -0400 Subject: [PATCH] feat: make upload scores descending for ordering --- src/posts/uploads.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posts/uploads.js b/src/posts/uploads.js index 3ab2a6aeb4..12564d0f17 100644 --- a/src/posts/uploads.js +++ b/src/posts/uploads.js @@ -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),