Update Boards.userBoards() to only return type 'board' by default

This commit is contained in:
John R. Supplee 2021-04-02 02:15:12 +02:00
parent edd07befe2
commit e43002d5ad

View file

@ -1330,8 +1330,11 @@ Boards.userBoards = (userId, archived = false, selector = {}) => {
if (typeof archived === 'boolean') { if (typeof archived === 'boolean') {
selector.archived = archived; selector.archived = archived;
} }
selector.$or = [{ permission: 'public' }]; if (!selector.type) {
selector.type = 'board';
}
selector.$or = [{ permission: 'public' }];
if (userId) { if (userId) {
selector.$or.push({ members: { $elemMatch: { userId, isActive: true } } }); selector.$or.push({ members: { $elemMatch: { userId, isActive: true } } });
} }
@ -1435,8 +1438,7 @@ if (Meteor.isServer) {
}, },
myLabelNames() { myLabelNames() {
let names = []; let names = [];
Boards.userBoards(Meteor.userId(), false, { type: 'board' }).forEach( Boards.userBoards(Meteor.userId()).forEach(board => {
board => {
names = names.concat( names = names.concat(
board.labels board.labels
.filter(label => !!label.name) .filter(label => !!label.name)
@ -1444,8 +1446,7 @@ if (Meteor.isServer) {
return label.name; return label.name;
}), }),
); );
}, });
);
return _.uniq(names).sort(); return _.uniq(names).sort();
}, },
myBoardNames() { myBoardNames() {