summaryrefslogtreecommitdiffstats
path: root/server/publications/activities.js
blob: 38c61ebf0ee8de6ec327ffbf06976e970e9f88f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// We use activities fields at two different places:
// 1. The board sidebar
// 2. The card activity tab
// We use this publication to paginate for these two publications.

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

  return Activities.find({
    [`${kind}Id`]: id,
  }, {
    limit,
    sort: {createdAt: -1},
  });
});