activities.js 466 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) => {
  6. check(kind, Match.Where((x) => {
  7. return ['board', 'card'].indexOf(x) !== -1;
  8. }));
  9. check(id, String);
  10. check(limit, Number);
  11. return Activities.find({
  12. [`${kind}Id`]: id,
  13. }, {
  14. limit,
  15. sort: {createdAt: -1},
  16. });
  17. });