mirror of
https://github.com/wekan/wekan.git
synced 2026-01-03 16:18:49 +01:00
Avoid importing imported cards or boards
This commit is contained in:
parent
64367a01dd
commit
a93de07fb9
2 changed files with 8 additions and 7 deletions
|
|
@ -298,22 +298,22 @@ Boards.helpers({
|
|||
return _id;
|
||||
},
|
||||
|
||||
searchCards(term) {
|
||||
searchCards(term, excludeImported) {
|
||||
check(term, Match.OneOf(String, null, undefined));
|
||||
|
||||
let query = { boardId: this._id };
|
||||
if (excludeImported) {
|
||||
query.importedId = null;
|
||||
}
|
||||
const projection = { limit: 10, sort: { createdAt: -1 } };
|
||||
|
||||
if (term) {
|
||||
const regex = new RegExp(term, 'i');
|
||||
|
||||
query = {
|
||||
boardId: this._id,
|
||||
$or: [
|
||||
query.$or = [
|
||||
{ title: regex },
|
||||
{ description: regex },
|
||||
],
|
||||
};
|
||||
];
|
||||
}
|
||||
|
||||
return Cards.find(query, projection);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue