Due Cards and Broken Cards: In All Users view, fixed to show cards only from other users Public Boards. Not anymore from private boards.

Thanks to xet7 !

Related #1667
This commit is contained in:
Lauri Ojansivu 2021-01-11 05:23:11 +02:00
parent 82236484bc
commit 801d0aacf0
4 changed files with 24 additions and 22 deletions

View file

@ -18,6 +18,8 @@ BlazeComponent.extendComponent({
{ boardId: { $in: [null, ''] } }, { boardId: { $in: [null, ''] } },
{ swimlaneId: { $in: [null, ''] } }, { swimlaneId: { $in: [null, ''] } },
{ listId: { $in: [null, ''] } }, { listId: { $in: [null, ''] } },
{ permission: 'public' },
{ members: { $elemMatch: { userId: user._id, isActive: true } } },
], ],
}; };

View file

@ -82,14 +82,14 @@ BlazeComponent.extendComponent({
let selector = { let selector = {
archived: false, archived: false,
}; };
// if user is not an admin allow her to see cards only from public boards // for every user including admin allow her to see cards only from public boards
// or those where she is a member // or those where she is a member
if (!user.isAdmin) { //if (!user.isAdmin) {
selector.$or = [ selector.$or = [
{ permission: 'public' }, { permission: 'public' },
{ members: { $elemMatch: { userId: user._id, isActive: true } } }, { members: { $elemMatch: { userId: user._id, isActive: true } } },
]; ];
} //}
Boards.find(selector).forEach(board => { Boards.find(selector).forEach(board => {
permiitedBoards.push(board._id); permiitedBoards.push(board._id);
}); });

View file

@ -59,7 +59,7 @@ BlazeComponent.extendComponent({
myCardsSort() { myCardsSort() {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log('sort:', Utils.myCardsSort()); //console.log('sort:', Utils.myCardsSort());
return Utils.myCardsSort(); return Utils.myCardsSort();
}, },

View file

@ -93,14 +93,14 @@ Meteor.publish('dueCards', function(allUsers = false) {
let selector = { let selector = {
archived: false, archived: false,
}; };
// if user is not an admin allow her to see cards only from boards where // for admins and users, allow her to see cards only from boards where
// she is a member // she is a member
if (!user.isAdmin) { //if (!user.isAdmin) {
selector.$or = [ selector.$or = [
{ permission: 'public' }, { permission: 'public' },
{ members: { $elemMatch: { userId: user._id, isActive: true } } }, { members: { $elemMatch: { userId: user._id, isActive: true } } },
]; ];
} //}
Boards.find(selector).forEach(board => { Boards.find(selector).forEach(board => {
permiitedBoards.push(board._id); permiitedBoards.push(board._id);
}); });
@ -180,14 +180,14 @@ Meteor.publish('brokenCards', function() {
const permiitedBoards = [null]; const permiitedBoards = [null];
let selector = {}; let selector = {};
// if user is not an admin allow her to see cards only from boards where // for admins and users, if user is not an admin allow her to see cards only from boards where
// she is a member // she is a member
if (!user.isAdmin) { //if (!user.isAdmin) {
selector.$or = [ selector.$or = [
{ permission: 'public' }, { permission: 'public' },
{ members: { $elemMatch: { userId: user._id, isActive: true } } }, { members: { $elemMatch: { userId: user._id, isActive: true } } },
]; ];
} //}
Boards.find(selector).forEach(board => { Boards.find(selector).forEach(board => {
permiitedBoards.push(board._id); permiitedBoards.push(board._id);
}); });