From bc2a20f04e32607f8488a9cecd815647fb43e40e Mon Sep 17 00:00:00 2001 From: "Sam X. Chen" Date: Fri, 18 Oct 2019 16:44:09 -0400 Subject: Add Feature: allow user to sort Lists in Board by his own preference, boardadmin can star list --- models/boards.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'models/boards.js') diff --git a/models/boards.js b/models/boards.js index c7f93022..85a7558c 100644 --- a/models/boards.js +++ b/models/boards.js @@ -409,18 +409,20 @@ Boards.helpers({ }, lists() { - const enabled = Meteor.user().hasShowDesktopDragHandles(); - return enabled ? this.draggableLists() : this.newestLists(); + 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 + const value = Meteor.user()._getListSortBy(); + const sortKey = { starred: -1, [value[0]]: value[1] }; // [["starred",-1],value]; return Lists.find( { boardId: this._id, archived: false, }, - { sort: { updatedAt: -1 } }, + { sort: sortKey }, ); }, draggableLists() { -- cgit v1.2.3-1-g7c22