activities.js 605 B

12345678910111213141516171819
  1. // We use activities fields at two different places:
  2. // 1. The board sidebar
  3. // 2. The card activity tab
  4. // We use this publication to paginate for these two publications.
  5. Meteor.publish('activities', (kind, id, limit, hideSystem) => {
  6. check(kind, Match.Where((x) => {
  7. return ['board', 'card'].indexOf(x) !== -1;
  8. }));
  9. check(id, String);
  10. check(limit, Number);
  11. check(hideSystem, Boolean);
  12. const selector = (hideSystem) ? {$and: [{activityType: 'addComment'}, {[`${kind}Id`]: id}]} : {[`${kind}Id`]: id};
  13. return Activities.find(selector, {
  14. limit,
  15. sort: {createdAt: -1},
  16. });
  17. });