Move every Activities.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)

This commit is contained in:
Martin Filser 2023-03-12 18:27:27 +01:00
parent 286617e7be
commit 7caf817c81
2 changed files with 15 additions and 8 deletions

View file

@ -33,9 +33,12 @@ Meteor.publish('activities', (kind, id, limit, hideSystem) => {
const selector = hideSystem
? { $and: [{ activityType: 'addComment' }, { [`${kind}Id`]: { $in: linkedElmtId } }] }
: { [`${kind}Id`]: { $in: linkedElmtId } };
const ret = Activities.find(selector, {
limit,
sort: { createdAt: -1 },
});
const ret = ReactiveCache.getActivities(selector,
{
limit,
sort: { createdAt: -1 },
},
true,
);
return ret;
});

View file

@ -132,9 +132,13 @@ function activities() {
const activityIds = ReactiveCache.getCurrentUser()?.profile?.notifications?.map(v => v.activity) || [];
let ret = [];
if (activityIds.length > 0) {
ret = Activities.find({
_id: { $in: activityIds },
});
return ret;
ret = ReactiveCache.getActivities(
{
_id: { $in: activityIds },
},
{},
true,
);
}
return ret;
}