Bug fix for #3864 searching archived cards and add new operators for organizations and teams

This commit is contained in:
John Supplee 2021-12-22 00:33:13 +02:00
parent 6ef612d04e
commit aa0dee1fba
8 changed files with 89 additions and 6 deletions

View file

@ -1501,8 +1501,8 @@ Boards.userBoards = (
selector.$or = [
{ permission: 'public' },
{ members: { $elemMatch: { userId, isActive: true } } },
{ 'orgs.orgId': { $in: user.orgIds() } },
{ 'teams.teamId': { $in : user.teamIds() } },
{ orgs: { $elemMatch: { orgId: { $in: user.orgIds() }, isActive: true } } },
{ teams: { $elemMatch: { teamId: { $in: user.teamIds() }, isActive: true } } },
];
return Boards.find(selector, projection);

View file

@ -345,6 +345,17 @@ Lists.mutations({
},
});
Lists.userArchivedLists = userId => {
return Lists.find({
boardId: { $in: Boards.userBoardIds(userId, null) },
archived: true,
})
};
Lists.userArchivedListIds = () => {
return Lists.userArchivedLists().map(list => { return list._id; });
};
Lists.archivedLists = () => {
return Lists.find({ archived: true });
};

View file

@ -306,6 +306,17 @@ Swimlanes.mutations({
},
});
Swimlanes.userArchivedSwimlanes = userId => {
return Swimlanes.find({
boardId: { $in: Boards.userBoardIds(userId, null) },
archived: true,
})
};
Swimlanes.userArchivedSwimlaneIds = () => {
return Swimlanes.userArchivedSwimlanes().map(swim => { return swim._id; });
};
Swimlanes.archivedSwimlanes = () => {
return Swimlanes.find({ archived: true });
};

View file

@ -521,12 +521,14 @@ Users.helpers({
},
teamIds() {
if (this.teams) {
// TODO: Should the Team collection be queried to determine if the team isActive?
return this.teams.map(team => { return team.teamId });
}
return [];
},
orgIds() {
if (this.orgs) {
// TODO: Should the Org collection be queried to determine if the organization isActive?
return this.orgs.map(org => { return org.orgId });
}
return [];