summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/boards/boardArchive.js2
-rw-r--r--client/components/boards/boardsList.js16
-rw-r--r--client/components/cards/cardDetails.js6
-rw-r--r--client/components/lists/listBody.js4
-rw-r--r--client/components/rules/actions/boardActions.js2
-rw-r--r--client/components/settings/settingBody.js2
-rw-r--r--client/components/sidebar/sidebar.js6
-rw-r--r--models/boards.js9
-rw-r--r--models/users.js30
-rw-r--r--server/publications/boards.js4
10 files changed, 50 insertions, 31 deletions
diff --git a/client/components/boards/boardArchive.js b/client/components/boards/boardArchive.js
index d3e65bd8..9f4d60a1 100644
--- a/client/components/boards/boardArchive.js
+++ b/client/components/boards/boardArchive.js
@@ -7,7 +7,7 @@ BlazeComponent.extendComponent({
return Boards.find(
{ archived: true },
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ }
},
);
},
diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js
index 65bed16a..aabc98e8 100644
--- a/client/components/boards/boardsList.js
+++ b/client/components/boards/boardsList.js
@@ -7,8 +7,8 @@ Template.boardListHeaderBar.events({
});
Template.boardListHeaderBar.helpers({
- title(){
- return FlowRouter.getRouteName() == 'home' ? 'my-boards' :'public';
+ title() {
+ return FlowRouter.getRouteName() == 'home' ? 'my-boards' : 'public';
},
templatesBoardId() {
return Meteor.user() && Meteor.user().getTemplatesBoardId();
@@ -27,16 +27,12 @@ BlazeComponent.extendComponent({
let query = {
archived: false,
type: 'board',
- }
+ };
if (FlowRouter.getRouteName() == 'home')
- query['members.userId'] = Meteor.userId()
- else
- query.permission = 'public'
+ query['members.userId'] = Meteor.userId();
+ else query.permission = 'public';
- return Boards.find(
- query,
- { sort: ['title'] },
- );
+ return Boards.find(query, { sort: { sort: 1 /* boards default sorting */ } });
},
isStarred() {
const user = Meteor.user();
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 9d31fc60..ce504146 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -727,7 +727,7 @@ BlazeComponent.extendComponent({
_id: { $ne: Meteor.user().getTemplatesBoardId() },
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
@@ -903,7 +903,7 @@ BlazeComponent.extendComponent({
},
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
@@ -974,7 +974,7 @@ BlazeComponent.extendComponent({
}
}
},
- 'click .js-delete': Popup.afterConfirm('cardDelete', function () {
+ 'click .js-delete': Popup.afterConfirm('cardDelete', function() {
Popup.close();
Cards.remove(this._id);
Utils.goBoardId(this.boardId);
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 03f88f63..88f88db0 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -411,7 +411,7 @@ BlazeComponent.extendComponent({
type: 'board',
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
@@ -597,7 +597,7 @@ BlazeComponent.extendComponent({
type: 'board',
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
diff --git a/client/components/rules/actions/boardActions.js b/client/components/rules/actions/boardActions.js
index c2f2375a..02910cc1 100644
--- a/client/components/rules/actions/boardActions.js
+++ b/client/components/rules/actions/boardActions.js
@@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
},
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
return boards;
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 319c066b..62752084 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -48,7 +48,7 @@ BlazeComponent.extendComponent({
'members.isAdmin': true,
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
},
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js
index 78b47a48..11471c2f 100644
--- a/client/components/sidebar/sidebar.js
+++ b/client/components/sidebar/sidebar.js
@@ -510,7 +510,7 @@ BlazeComponent.extendComponent({
'members.userId': Meteor.userId(),
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
},
@@ -589,7 +589,7 @@ BlazeComponent.extendComponent({
'subtext-with-parent',
'no-parent',
];
- options.forEach(function (element) {
+ options.forEach(function(element) {
if (element !== value) {
$(`#${element} ${MCB}`).toggleClass(CKCLS, false);
$(`#${element}`).toggleClass(CKCLS, false);
@@ -688,7 +688,7 @@ BlazeComponent.extendComponent({
'members.userId': Meteor.userId(),
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
);
},
diff --git a/models/boards.js b/models/boards.js
index fba690a7..fdb07f89 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -1474,7 +1474,7 @@ if (Meteor.isServer) {
'members.userId': paramUserId,
},
{
- sort: ['title'],
+ sort: { sort: 1 /* boards default sorting */ },
},
).map(function(board) {
return {
@@ -1504,7 +1504,12 @@ if (Meteor.isServer) {
Authentication.checkUserId(req.userId);
JsonRoutes.sendResult(res, {
code: 200,
- data: Boards.find({ permission: 'public' }).map(function(doc) {
+ data: Boards.find(
+ { permission: 'public' },
+ {
+ sort: { sort: 1 /* boards default sorting */ },
+ },
+ ).map(function(doc) {
return {
_id: doc._id,
title: doc.title,
diff --git a/models/users.js b/models/users.js
index a9eeb38b..f4b7329a 100644
--- a/models/users.js
+++ b/models/users.js
@@ -386,12 +386,20 @@ if (Meteor.isClient) {
Users.helpers({
boards() {
- return Boards.find({ 'members.userId': this._id });
+ return Boards.find(
+ { 'members.userId': this._id },
+ { sort: { sort: 1 /* boards default sorting */ } },
+ );
},
starredBoards() {
const { starredBoards = [] } = this.profile || {};
- return Boards.find({ archived: false, _id: { $in: starredBoards } });
+ return Boards.find(
+ { archived: false, _id: { $in: starredBoards } },
+ {
+ sort: { sort: 1 /* boards default sorting */ },
+ },
+ );
},
hasStarred(boardId) {
@@ -401,7 +409,12 @@ Users.helpers({
invitedBoards() {
const { invitedBoards = [] } = this.profile || {};
- return Boards.find({ archived: false, _id: { $in: invitedBoards } });
+ return Boards.find(
+ { archived: false, _id: { $in: invitedBoards } },
+ {
+ sort: { sort: 1 /* boards default sorting */ },
+ },
+ );
},
isInvitedTo(boardId) {
@@ -1292,10 +1305,13 @@ if (Meteor.isServer) {
let data = Meteor.users.findOne({ _id: id });
if (data !== undefined) {
if (action === 'takeOwnership') {
- data = Boards.find({
- 'members.userId': id,
- 'members.isAdmin': true,
- }).map(function(board) {
+ data = Boards.find(
+ {
+ 'members.userId': id,
+ 'members.isAdmin': true,
+ },
+ { sort: { sort: 1 /* boards default sorting */ } },
+ ).map(function(board) {
if (board.hasMember(req.userId)) {
board.removeMember(req.userId);
}
diff --git a/server/publications/boards.js b/server/publications/boards.js
index 6fbd9860..b54f27a8 100644
--- a/server/publications/boards.js
+++ b/server/publications/boards.js
@@ -36,6 +36,7 @@ Meteor.publish('boards', function() {
permission: 1,
type: 1,
},
+ sort: { sort: 1 /* boards default sorting */ },
},
);
});
@@ -61,6 +62,7 @@ Meteor.publish('archivedBoards', function() {
slug: 1,
title: 1,
},
+ sort: { sort: 1 /* boards default sorting */ },
},
);
});
@@ -90,7 +92,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
$or,
// Sort required to ensure oplog usage
},
- { limit: 1, sort: { _id: 1 } },
+ { limit: 1, sort: { sort: 1 /* boards default sorting */, _id: 1 } },
),
function(boardId, board) {
this.cursor(Lists.find({ boardId, archived: isArchived }));