mirror of
https://github.com/wekan/wekan.git
synced 2026-03-04 04:40:16 +01:00
Add new status predicates of public and private
This commit is contained in:
parent
b419e17cac
commit
c7276ee614
3 changed files with 37 additions and 6 deletions
|
|
@ -263,6 +263,8 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
|
|||
if (queryParams.selector) {
|
||||
selector = queryParams.selector;
|
||||
} else {
|
||||
const boardsSelector = {};
|
||||
|
||||
let archived = false;
|
||||
let endAt = null;
|
||||
if (queryParams.status.length) {
|
||||
|
|
@ -273,6 +275,8 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
|
|||
archived = null;
|
||||
} else if (status === 'ended') {
|
||||
endAt = { $nin: [null, ''] };
|
||||
} else if (['private', 'public'].includes(status)) {
|
||||
boardsSelector.permission = status;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -282,27 +286,35 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
|
|||
$and: [],
|
||||
};
|
||||
|
||||
const boardsSelector = {};
|
||||
if (archived !== null) {
|
||||
boardsSelector.archived = archived;
|
||||
if (archived) {
|
||||
selector.boardId = { $in: Boards.userBoardIds(userId, null) };
|
||||
selector.boardId = {
|
||||
$in: Boards.userBoardIds(userId, null, boardsSelector),
|
||||
};
|
||||
selector.$and.push({
|
||||
$or: [
|
||||
{ boardId: { $in: Boards.userBoardIds(userId, archived) } },
|
||||
{
|
||||
boardId: {
|
||||
$in: Boards.userBoardIds(userId, archived, boardsSelector),
|
||||
},
|
||||
},
|
||||
{ swimlaneId: { $in: Swimlanes.archivedSwimlaneIds() } },
|
||||
{ listId: { $in: Lists.archivedListIds() } },
|
||||
{ archived: true },
|
||||
],
|
||||
});
|
||||
} else {
|
||||
selector.boardId = { $in: Boards.userBoardIds(userId, false) };
|
||||
selector.boardId = {
|
||||
$in: Boards.userBoardIds(userId, false, boardsSelector),
|
||||
};
|
||||
selector.swimlaneId = { $nin: Swimlanes.archivedSwimlaneIds() };
|
||||
selector.listId = { $nin: Lists.archivedListIds() };
|
||||
selector.archived = false;
|
||||
}
|
||||
} else {
|
||||
selector.boardId = { $in: Boards.userBoardIds(userId, null) };
|
||||
selector.boardId = {
|
||||
$in: Boards.userBoardIds(userId, null, boardsSelector),
|
||||
};
|
||||
}
|
||||
if (endAt !== null) {
|
||||
selector.endAt = endAt;
|
||||
|
|
@ -720,6 +732,9 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
|
|||
Lists.find({ _id: { $in: lists } }, { fields }),
|
||||
CustomFields.find({ _id: { $in: customFieldIds } }),
|
||||
Users.find({ _id: { $in: users } }, { fields: Users.safeFields }),
|
||||
Checklists.find({ cardId: { $in: cards.map(c => c._id) } }),
|
||||
Attachments.find({ cardId: { $in: cards.map(c => c._id) } }),
|
||||
CardComments.find({ cardId: { $in: cards.map(c => c._id) } }),
|
||||
SessionData.find({ userId: this.userId, sessionId }),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue