2
0

activities.js 585 B

123456789101112131415161718192021222324
  1. // We use activities fields at three different places:
  2. // 1. The home page that contains
  3. // 2. The board
  4. // 3.
  5. // We use publish paginate for these three publications.
  6. Meteor.publish('activities', function(mode, id, limit) {
  7. check(mode, Match.Where(function(x) {
  8. return ['board', 'card'].indexOf(x) !== -1;
  9. }));
  10. check(id, String);
  11. check(limit, Number);
  12. var selector = {};
  13. if (mode === 'board')
  14. selector.boardId = id;
  15. else if (mode === 'card')
  16. selector.cardId = id;
  17. return Activities.find(selector, {
  18. sort: {createdAt: -1},
  19. limit: limit
  20. });
  21. });