mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
refactor: remove breaking change in pin expiry
This commit is contained in:
@@ -57,21 +57,18 @@ module.exports = function (Topics) {
|
||||
|
||||
async function getCidTids(params) {
|
||||
const sets = [];
|
||||
const pinnedSets = [];
|
||||
params.cids.forEach(function (cid) {
|
||||
if (params.sort === 'recent') {
|
||||
sets.push('cid:' + cid + ':tids');
|
||||
} else {
|
||||
sets.push('cid:' + cid + ':tids' + (params.sort ? ':' + params.sort : ''));
|
||||
}
|
||||
pinnedSets.push('cid:' + cid + ':tids:pinned');
|
||||
});
|
||||
const [tids, pinnedTids] = await Promise.all([
|
||||
db.getSortedSetRevRange(sets, 0, meta.config.recentMaxTopics - 1),
|
||||
categories.getPinnedTids({
|
||||
cid: params.cids,
|
||||
start: 0,
|
||||
stop: -1,
|
||||
}),
|
||||
]);
|
||||
let pinnedTids = await db.getSortedSetRevRange(pinnedSets, 0, -1);
|
||||
pinnedTids = await Topics.tools.checkPinExpiry(pinnedTids);
|
||||
const tids = await db.getSortedSetRevRange(sets, 0, meta.config.recentMaxTopics - 1);
|
||||
return pinnedTids.concat(tids);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user