diff options
author | Sam X. Chen <sam.xi.chen@gmail.com> | 2019-10-18 16:44:09 -0400 |
---|---|---|
committer | Sam X. Chen <sam.xi.chen@gmail.com> | 2019-10-18 16:44:09 -0400 |
commit | bc2a20f04e32607f8488a9cecd815647fb43e40e (patch) | |
tree | 1f6105203b71fb5220591f057bf3ed63aac79521 /models/lists.js | |
parent | 2737d6b23f3a0fd2314236a85fbdee536df745a2 (diff) | |
download | wekan-bc2a20f04e32607f8488a9cecd815647fb43e40e.tar.gz wekan-bc2a20f04e32607f8488a9cecd815647fb43e40e.tar.bz2 wekan-bc2a20f04e32607f8488a9cecd815647fb43e40e.zip |
Add Feature: allow user to sort Lists in Board by his own preference, boardadmin can star list
Diffstat (limited to 'models/lists.js')
-rw-r--r-- | models/lists.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/models/lists.js b/models/lists.js index 9136c337..16ad434c 100644 --- a/models/lists.js +++ b/models/lists.js @@ -11,6 +11,15 @@ Lists.attachSchema( */ type: String, }, + starred: { + /** + * if a list is stared + * then we put it on the top + */ + type: Boolean, + optional: true, + defaultValue: false, + }, archived: { /** * is the list archived @@ -81,10 +90,14 @@ Lists.attachSchema( denyUpdate: false, // eslint-disable-next-line consistent-return autoValue() { - if (this.isInsert || this.isUpsert || this.isUpdate) { + // this is redundant with updatedAt + /*if (this.isInsert || this.isUpsert || this.isUpdate) { return new Date(); } else { this.unset(); + }*/ + if (!this.isSet) { + return new Date(); } }, }, @@ -252,6 +265,10 @@ Lists.helpers({ return this.type === 'template-list'; }, + isStarred() { + return this.starred === true; + }, + remove() { Lists.remove({ _id: this._id }); }, @@ -261,6 +278,9 @@ Lists.mutations({ rename(title) { return { $set: { title } }; }, + star(enable = true) { + return { $set: { starred: !!enable } }; + }, archive() { if (this.isTemplateList()) { |