mirror of
https://github.com/wekan/wekan.git
synced 2026-02-10 02:04:20 +01:00
add a notification drawer like trello
This commit is contained in:
parent
29d62440a5
commit
9819c9f801
20 changed files with 701 additions and 257 deletions
|
|
@ -219,6 +219,9 @@ if (Meteor.isServer) {
|
|||
type: 'card',
|
||||
activityType: 'addAttachment',
|
||||
attachmentId: doc._id,
|
||||
// this preserves the name so that notifications can be meaningful after
|
||||
// this file is removed
|
||||
attachmentName: doc.original.name,
|
||||
boardId: doc.boardId,
|
||||
cardId: doc.cardId,
|
||||
listId: doc.listId,
|
||||
|
|
@ -246,18 +249,15 @@ if (Meteor.isServer) {
|
|||
type: 'card',
|
||||
activityType: 'deleteAttachment',
|
||||
attachmentId: doc._id,
|
||||
// this preserves the name so that notifications can be meaningful after
|
||||
// this file is removed
|
||||
attachmentName: doc.original.name,
|
||||
boardId: doc.boardId,
|
||||
cardId: doc.cardId,
|
||||
listId: doc.listId,
|
||||
swimlaneId: doc.swimlaneId,
|
||||
});
|
||||
});
|
||||
|
||||
Attachments.files.after.remove((userId, doc) => {
|
||||
Activities.remove({
|
||||
attachmentId: doc._id,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default Attachments;
|
||||
|
|
|
|||
|
|
@ -369,6 +369,9 @@ if (Meteor.isServer) {
|
|||
activityType: 'createList',
|
||||
boardId: doc.boardId,
|
||||
listId: doc._id,
|
||||
// this preserves the name so that the activity can be useful after the
|
||||
// list is deleted
|
||||
title: doc.title,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -397,6 +400,9 @@ if (Meteor.isServer) {
|
|||
activityType: 'archivedList',
|
||||
listId: doc._id,
|
||||
boardId: doc.boardId,
|
||||
// this preserves the name so that the activity can be useful after the
|
||||
// list is deleted
|
||||
title: doc.title,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -165,7 +165,20 @@ Users.attachSchema(
|
|||
/**
|
||||
* enabled notifications for the user
|
||||
*/
|
||||
type: [String],
|
||||
type: [Object],
|
||||
optional: true,
|
||||
},
|
||||
'profile.notifications.$.activity': {
|
||||
/**
|
||||
* The id of the activity this notification references
|
||||
*/
|
||||
type: String,
|
||||
},
|
||||
'profile.notifications.$.read': {
|
||||
/**
|
||||
* the date on which this notification was read
|
||||
*/
|
||||
type: Date,
|
||||
optional: true,
|
||||
},
|
||||
'profile.showCardsCountAt': {
|
||||
|
|
@ -429,6 +442,20 @@ Users.helpers({
|
|||
return _.contains(notifications, activityId);
|
||||
},
|
||||
|
||||
notifications() {
|
||||
const { notifications = [] } = this.profile || {};
|
||||
for (const index in notifications) {
|
||||
if (!notifications.hasOwnProperty(index)) continue;
|
||||
const notification = notifications[index];
|
||||
// this preserves their db sort order for editing
|
||||
notification.dbIndex = index;
|
||||
notification.activity = Activities.findOne(notification.activity);
|
||||
}
|
||||
// this sorts them newest to oldest to match Trello's behavior
|
||||
notifications.reverse();
|
||||
return notifications;
|
||||
},
|
||||
|
||||
hasShowDesktopDragHandles() {
|
||||
const profile = this.profile || {};
|
||||
return profile.showDesktopDragHandles || false;
|
||||
|
|
@ -573,7 +600,7 @@ Users.mutations({
|
|||
addNotification(activityId) {
|
||||
return {
|
||||
$addToSet: {
|
||||
'profile.notifications': activityId,
|
||||
'profile.notifications': { activity: activityId },
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -581,7 +608,7 @@ Users.mutations({
|
|||
removeNotification(activityId) {
|
||||
return {
|
||||
$pull: {
|
||||
'profile.notifications': activityId,
|
||||
'profile.notifications': { activity: activityId },
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue