From 7d6d3af54a2fc1fb68634725eb754b22f02fd430 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 29 Oct 2019 19:05:44 +0200 Subject: Add Features: allowing lists to be sorted by modifiedAt when not in draggable mode. Bug Fix #2093: the broken should be prior to file attachment feature introduced, and tested export board is working. Thanks to whowillcare ! ( xet7 merged this pull request manually from https://github.com/wekan/wekan/pull/2756 ) Closes #2093 --- models/swimlanes.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'models/swimlanes.js') diff --git a/models/swimlanes.js b/models/swimlanes.js index 46e410da..831f1eff 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -174,6 +174,21 @@ Swimlanes.helpers({ }, lists() { + const enabled = Meteor.user().hasSortBy(); + return enabled ? this.newestLists() : 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, -- cgit v1.2.3-1-g7c22