summaryrefslogtreecommitdiffstats
path: root/models/boards.js
diff options
context:
space:
mode:
authorSam X. Chen <sam.xi.chen@gmail.com>2019-10-10 22:57:40 -0400
committerSam X. Chen <sam.xi.chen@gmail.com>2019-10-10 22:57:40 -0400
commit77f8b76d4e13c35ea3451622176bbb69a4d39a32 (patch)
tree259728686df72cd8747d112cb1907f7ab102899e /models/boards.js
parente60926f8471c05f50877f46568554e7b2f24815a (diff)
downloadwekan-77f8b76d4e13c35ea3451622176bbb69a4d39a32.tar.gz
wekan-77f8b76d4e13c35ea3451622176bbb69a4d39a32.tar.bz2
wekan-77f8b76d4e13c35ea3451622176bbb69a4d39a32.zip
Add Features: allowing lists to be sorted by modifiedAt when not in draggable mode
Diffstat (limited to 'models/boards.js')
-rw-r--r--models/boards.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/models/boards.js b/models/boards.js
index a9348478..c7f93022 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -409,6 +409,21 @@ Boards.helpers({
},
lists() {
+ const enabled = Meteor.user().hasShowDesktopDragHandles();
+ return enabled ? this.draggableLists() : this.newestLists();
+ },
+
+ newestLists() {
+ // sorted lists from newest to the oldest, by its creation date or its cards' last modification date
+ return Lists.find(
+ {
+ boardId: this._id,
+ archived: false,
+ },
+ { sort: { updatedAt: -1 } },
+ );
+ },
+ draggableLists() {
return Lists.find({ boardId: this._id }, { sort: { sort: 1 } });
},