summaryrefslogtreecommitdiffstats
path: root/models/swimlanes.js
diff options
context:
space:
mode:
author蔡仲明 (Romulus Urakagi Tsai) <urakagi@gmail.com>2019-11-21 11:25:56 +0800
committerGitHub <noreply@github.com>2019-11-21 11:25:56 +0800
commit3e0bedd8c7a6dec97352212adb1cbde1ade44190 (patch)
tree651ff30d25ddb0416444370368d699e597c142d7 /models/swimlanes.js
parent9bbeb73db1cd0ce1caaaca8dfb14ea92131bbf9d (diff)
parent4f5de87cc4c2281bd576548693de7c94e6a988c6 (diff)
downloadwekan-3e0bedd8c7a6dec97352212adb1cbde1ade44190.tar.gz
wekan-3e0bedd8c7a6dec97352212adb1cbde1ade44190.tar.bz2
wekan-3e0bedd8c7a6dec97352212adb1cbde1ade44190.zip
Merge pull request #1 from wekan/master
Update master
Diffstat (limited to 'models/swimlanes.js')
-rw-r--r--models/swimlanes.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/models/swimlanes.js b/models/swimlanes.js
index 769aaed3..aa7016f7 100644
--- a/models/swimlanes.js
+++ b/models/swimlanes.js
@@ -38,6 +38,8 @@ Swimlanes.attachSchema(
autoValue() {
if (this.isInsert) {
return new Date();
+ } else if (this.isUpsert) {
+ return { $setOnInsert: new Date() };
} else {
this.unset();
}
@@ -172,6 +174,25 @@ Swimlanes.helpers({
},
lists() {
+ //currentUser = Meteor.user();
+ //if (currentUser) {
+ // enabled = Meteor.user().hasSortBy();
+ //}
+ //return enabled ? this.newestLists() : this.draggableLists();
+ return this.draggableLists();
+ },
+ newestLists() {
+ // sorted lists from newest to the oldest, by its creation date or its cards' last modification date
+ return Lists.find(
+ {
+ boardId: this.boardId,
+ swimlaneId: { $in: [this._id, ''] },
+ archived: false,
+ },
+ { sort: { modifiedAt: -1 } },
+ );
+ },
+ draggableLists() {
return Lists.find(
{
boardId: this.boardId,