notification.js 821 B

12345678910111213141516171819202122232425262728
  1. Template.notification.events({
  2. 'click .read-status .materialCheckBox'() {
  3. const update = {};
  4. update[`profile.notifications.${this.index}.read`] = this.read
  5. ? null
  6. : Date.now();
  7. Users.update(Meteor.userId(), { $set: update });
  8. },
  9. 'click .remove a'() {
  10. Meteor.user().removeNotification(this.activityData._id);
  11. },
  12. });
  13. Template.notification.helpers({
  14. mode: 'board',
  15. isOfActivityType(activityId, type) {
  16. const activity = Activities.findOne(activityId);
  17. return activity && activity.activityType === type;
  18. },
  19. activityType(activityId) {
  20. const activity = Activities.findOne(activityId);
  21. return activity ? activity.activityType : '';
  22. },
  23. activityUser(activityId) {
  24. const activity = Activities.findOne(activityId);
  25. return activity && activity.userId;
  26. },
  27. });