fix: push instead of unshift, now that order is reversed

This commit is contained in:
Julian Lam
2024-06-28 16:28:34 -04:00
parent a2fb939b5c
commit cc0bbcb7bf

View File

@@ -70,7 +70,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
} }
const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.slice(0, -1).map(p => p.pid)); const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.slice(0, -1).map(p => p.pid));
members.push(await posts.exists(mainPid)); members.unshift(await posts.exists(mainPid));
if (tid && members.every(Boolean)) { if (tid && members.every(Boolean)) {
// All cached, return early. // All cached, return early.
// winston.verbose('[notes/assert] No new notes to process.'); // winston.verbose('[notes/assert] No new notes to process.');
@@ -122,18 +122,6 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
const count = unprocessed.length; const count = unprocessed.length;
// winston.verbose(`[notes/assert] ${count} new note(s) found.`); // winston.verbose(`[notes/assert] ${count} new note(s) found.`);
const [ids, timestamps] = [
unprocessed.map(n => (utils.isNumber(n.pid) ? parseInt(n.pid, 10) : n.pid)),
unprocessed.map(n => n.timestamp),
];
// mainPid doesn't belong in posts zset
if (ids.includes(mainPid)) {
const idx = ids.indexOf(mainPid);
ids.splice(idx, 1);
timestamps.splice(idx, 1);
}
let tags; let tags;
if (!hasTid) { if (!hasTid) {
const { to, cc, attachment } = mainPost._activitypub; const { to, cc, attachment } = mainPost._activitypub;