summaryrefslogtreecommitdiffstats
path: root/client/components/notifications/notification.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-04-02 01:09:35 +0300
committerLauri Ojansivu <x@xet7.org>2020-04-02 01:09:35 +0300
commite34f240c35b6eaec3e3ac2830129ddf914de5feb (patch)
tree9185e821c0e24cd1c9ae55da416d30b974035c31 /client/components/notifications/notification.js
parent56667112d7fd146a9847794207e9a2224b1115d7 (diff)
parent8ea86ae0b9e4351b935fde45c77f37d09778739d (diff)
downloadwekan-e34f240c35b6eaec3e3ac2830129ddf914de5feb.tar.gz
wekan-e34f240c35b6eaec3e3ac2830129ddf914de5feb.tar.bz2
wekan-e34f240c35b6eaec3e3ac2830129ddf914de5feb.zip
Merge branch 'jtbairdsr-master'
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;
+ },
+});