Page MenuHomePhabricator

D4722.diff
No OneTemporary

D4722.diff

diff --git a/keyserver/src/fetchers/message-fetchers.js b/keyserver/src/fetchers/message-fetchers.js
--- a/keyserver/src/fetchers/message-fetchers.js
+++ b/keyserver/src/fetchers/message-fetchers.js
@@ -115,7 +115,7 @@
JSON_EXTRACT(mm.permissions, ${visibleExtractString}) IS TRUE AND
`;
collapseQuery.append(mergeOrConditions(sqlTuples));
- collapseQuery.append(SQL`ORDER BY m.time DESC`);
+ collapseQuery.append(SQL`ORDER BY m.time DESC, m.id DESC`);
const [collapseResult] = await dbQuery(collapseQuery);
const rowsByUser = new Map();
@@ -315,7 +315,7 @@
// - More details available here:
// https://mariadb.com/kb/en/why-is-order-by-in-a-from-subquery-ignored/
query.append(SQL`
- ORDER BY m.thread, m.time DESC
+ ORDER BY m.thread, m.time DESC, m.id DESC
LIMIT 18446744073709551615
) x
) y
@@ -328,7 +328,9 @@
m.time, m.type, m.creation, stm.permissions AS subthread_permissions,
up.id AS uploadID, up.type AS uploadType, up.secret AS uploadSecret,
up.extra AS uploadExtra,
- ROW_NUMBER() OVER (PARTITION BY threadID ORDER BY time DESC) n
+ ROW_NUMBER() OVER (
+ PARTITION BY threadID ORDER BY m.time DESC, m.id DESC
+ ) n
FROM messages m
LEFT JOIN uploads up ON up.container = m.id
LEFT JOIN memberships mm
@@ -557,7 +559,7 @@
`;
query.append(selectionClause);
query.append(SQL`
- ORDER BY m.thread, m.time DESC
+ ORDER BY m.thread, m.time DESC, m.id DESC
`);
const [result] = await dbQuery(query);
const derivedMessages = await fetchDerivedMessages(result, viewer);

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 7:08 PM (7 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2718147
Default Alt Text
D4722.diff (1 KB)

Event Timeline