summaryrefslogtreecommitdiffstats
path: root/client/components/notifications/notificationsDrawer.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/notifications/notificationsDrawer.js')
-rw-r--r--client/components/notifications/notificationsDrawer.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/client/components/notifications/notificationsDrawer.js b/client/components/notifications/notificationsDrawer.js
index 98d4750d..76abeea7 100644
--- a/client/components/notifications/notificationsDrawer.js
+++ b/client/components/notifications/notificationsDrawer.js
@@ -16,6 +16,13 @@ Template.notificationsDrawer.helpers({
transformedProfile() {
return Users.findOne(Meteor.userId());
},
+ readNotifications() {
+ const readNotifications = _.filter(
+ Meteor.user().profile.notifications,
+ v => !!v.read,
+ );
+ return readNotifications.length;
+ },
});
Template.notificationsDrawer.events({
@@ -35,4 +42,12 @@ Template.notificationsDrawer.events({
'click .toggle-read'() {
Session.set('showReadNotifications', !Session.get('showReadNotifications'));
},
+ 'click .remove-read'() {
+ const user = Meteor.user();
+ for (const notification of user.profile.notifications) {
+ if (notification.read) {
+ user.removeNotification(notification.activity);
+ }
+ }
+ },
});