summaryrefslogtreecommitdiffstats
path: root/models/boards.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-23 20:41:36 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commitf888cfd565b197903c24a07221f6a6a44e1b6223 (patch)
tree7745b9c3913ae62f2bc08fb0a1049ec9754f2d4d /models/boards.js
parent044126188d28a24b0df5d67cf69d081ce7790886 (diff)
downloadwekan-f888cfd565b197903c24a07221f6a6a44e1b6223.tar.gz
wekan-f888cfd565b197903c24a07221f6a6a44e1b6223.tar.bz2
wekan-f888cfd565b197903c24a07221f6a6a44e1b6223.zip
Allow list creation from template
Diffstat (limited to 'models/boards.js')
-rw-r--r--models/boards.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/models/boards.js b/models/boards.js
index 25cf5e37..530a6f71 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -463,6 +463,30 @@ Boards.helpers({
return _id;
},
+ searchLists(term) {
+ check(term, Match.OneOf(String, null, undefined));
+
+ const query = { boardId: this._id };
+ if (this.isTemplatesBoard()) {
+ query.type = 'template-list';
+ query.archived = false;
+ } else {
+ query.type = {$nin: ['template-list']};
+ }
+ const projection = { limit: 10, sort: { createdAt: -1 } };
+
+ if (term) {
+ const regex = new RegExp(term, 'i');
+
+ query.$or = [
+ { title: regex },
+ { description: regex },
+ ];
+ }
+
+ return Lists.find(query, projection);
+ },
+
searchCards(term, excludeLinked) {
check(term, Match.OneOf(String, null, undefined));