summaryrefslogtreecommitdiffstats
path: root/server/publications/activities.js
blob: 5277206ced95ba34cc3494fc84a09cf64c472275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// We use activities fields at three different places:
// 1. The home page that contains
// 2. The board
// 3.
// We use publish paginate for these three publications.

Meteor.publish('activities', function(mode, id, limit) {
  check(mode, Match.Where(function(x) {
    return ['board', 'card'].indexOf(x) !== -1;
  }));
  check(id, String);
  check(limit, Number);

  var selector = {};
  if (mode === 'board')
    selector.boardId = id;
  else if (mode === 'card')
    selector.cardId = id;

  return Activities.find(selector, {
    sort: {createdAt: -1},
    limit: limit
  });
});