mirror of
https://github.com/wekan/wekan.git
synced 2025-12-20 09:20:12 +01:00
add a "remove all read" button to notification menu
This commit is contained in:
parent
1e20e2601f
commit
a182dde11f
4 changed files with 32 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue