Merge branch 'master' into lib-change

This commit is contained in:
Romulus Tsai 蔡仲明 2020-05-08 10:13:11 +08:00
commit c3458855bd
425 changed files with 15176 additions and 28903 deletions

View file

@ -18,7 +18,7 @@ Meteor.publish('boards', function() {
archived: false,
$or: [
{
_id: { $in: starredBoards },
// _id: { $in: starredBoards }, // Commented out, to get a list of all public boards
permission: 'public',
},
{ members: { $elemMatch: { userId, isActive: true } } },
@ -35,7 +35,9 @@ Meteor.publish('boards', function() {
members: 1,
permission: 1,
type: 1,
sort: 1,
},
sort: { sort: 1 /* boards default sorting */ },
},
);
});
@ -61,6 +63,7 @@ Meteor.publish('archivedBoards', function() {
slug: 1,
title: 1,
},
sort: { sort: 1 /* boards default sorting */ },
},
);
});
@ -90,7 +93,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
$or,
// Sort required to ensure oplog usage
},
{ limit: 1, sort: { _id: 1 } },
{ limit: 1, sort: { sort: 1 /* boards default sorting */ } },
),
function(boardId, board) {
this.cursor(Lists.find({ boardId, archived: isArchived }));
@ -192,6 +195,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
username: 1,
'profile.fullname': 1,
'profile.avatarUrl': 1,
'profile.initials': 1,
},
},
),

View file

@ -0,0 +1,101 @@
// We use these when displaying notifications in the notificationsDrawer
// gets all activities associated with the current user
Meteor.publish('notificationActivities', () => {
return activities();
});
// gets all attachments associated with activities associated with the current user
Meteor.publish('notificationAttachments', function() {
return Attachments.find({
_id: {
$in: activities()
.map(v => v.attachmentId)
.filter(v => !!v),
},
});
});
// gets all cards associated with activities associated with the current user
Meteor.publish('notificationCards', function() {
return Cards.find({
_id: {
$in: activities()
.map(v => v.cardId)
.filter(v => !!v),
},
});
});
// gets all checklistItems associated with activities associated with the current user
Meteor.publish('notificationChecklistItems', function() {
return ChecklistItems.find({
_id: {
$in: activities()
.map(v => v.checklistItemId)
.filter(v => !!v),
},
});
});
// gets all checklists associated with activities associated with the current user
Meteor.publish('notificationChecklists', function() {
return Checklists.find({
_id: {
$in: activities()
.map(v => v.checklistId)
.filter(v => !!v),
},
});
});
// gets all comments associated with activities associated with the current user
Meteor.publish('notificationComments', function() {
return CardComments.find({
_id: {
$in: activities()
.map(v => v.commentId)
.filter(v => !!v),
},
});
});
// gets all lists associated with activities associated with the current user
Meteor.publish('notificationLists', function() {
return Lists.find({
_id: {
$in: activities()
.map(v => v.listId)
.filter(v => !!v),
},
});
});
// gets all swimlanes associated with activities associated with the current user
Meteor.publish('notificationSwimlanes', function() {
return Swimlanes.find({
_id: {
$in: activities()
.map(v => v.swimlaneId)
.filter(v => !!v),
},
});
});
// gets all users associated with activities associated with the current user
Meteor.publish('notificationUsers', function() {
return Users.find({
_id: {
$in: activities()
.map(v => v.userId)
.filter(v => !!v),
},
});
});
function activities() {
const notifications = Meteor.user().profile.notifications || [];
return Activities.find({
_id: { $in: notifications.map(v => v.activity) },
});
}

View file

@ -6,6 +6,7 @@ Meteor.publish('user-miniprofile', function(userId) {
username: 1,
'profile.fullname': 1,
'profile.avatarUrl': 1,
'profile.initials': 1,
},
});
});