summaryrefslogtreecommitdiffstats
path: root/client/components/notifications/notification.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/notifications/notification.js')
-rw-r--r--client/components/notifications/notification.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/client/components/notifications/notification.js b/client/components/notifications/notification.js
new file mode 100644
index 00000000..89277520
--- /dev/null
+++ b/client/components/notifications/notification.js
@@ -0,0 +1,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;
+ },
+});