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') {
selector.archived = archived;
}
selector.$or = [{ permission: 'public' }];
if (!selector.type) {
selector.type = 'board';
}
selector.$or = [{ permission: 'public' }];
if (userId) {
selector.$or.push({ members: { $elemMatch: { userId, isActive: true } } });
}
@ -1435,17 +1438,15 @@ if (Meteor.isServer) {
},
myLabelNames() {
let names = [];
Boards.userBoards(Meteor.userId(), false, { type: 'board' }).forEach(
board => {
names = names.concat(
board.labels
.filter(label => !!label.name)
.map(label => {
return label.name;
}),
);
},
);
Boards.userBoards(Meteor.userId()).forEach(board => {
names = names.concat(
board.labels
.filter(label => !!label.name)
.map(label => {
return label.name;
}),
);
});
return _.uniq(names).sort();
},
myBoardNames() {