summaryrefslogtreecommitdiffstats
path: root/client/components/notifications/notification.js
blob: 8927752026b62b4686173c78e546ba5b4078b2be (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
25
26
27
28
Template.notification.events({
  'click .read-status .materialCheckBox'() {
    const update = {};
    update[`profile.notifications.${this.index}.read`] = this.read
      ? null
      : Date.now();
    Users.update(Meteor.userId(), { $set: update });
  },
  'click .remove a'() {
    Meteor.user().removeNotification(this.activityData._id);
  },
});

Template.notification.helpers({
  mode: 'board',
  isOfActivityType(activityId, type) {
    const activity = Activities.findOne(activityId);
    return activity && activity.activityType === type;
  },
  activityType(activityId) {
    const activity = Activities.findOne(activityId);
    return activity ? activity.activityType : '';
  },
  activityUser(activityId) {
    const activity = Activities.findOne(activityId);
    return activity && activity.userId;
  },
});