mirror of
https://github.com/wekan/wekan.git
synced 2026-02-01 14:11:48 +01:00
Merge branch 'master' into broken
This commit is contained in:
commit
4ebad9efc1
20 changed files with 643 additions and 620 deletions
|
|
@ -43,71 +43,6 @@ Meteor.publish('boards', function() {
|
|||
);
|
||||
});
|
||||
|
||||
Meteor.publish('mySwimlanes', function() {
|
||||
const userId = this.userId;
|
||||
const swimlanes = [];
|
||||
|
||||
Cards.find({
|
||||
archived: false,
|
||||
$or: [{ members: userId }, { assignees: userId }],
|
||||
}).forEach(card => {
|
||||
swimlanes.push(card.swimlaneId);
|
||||
});
|
||||
|
||||
return Swimlanes.find(
|
||||
{
|
||||
// archived: false,
|
||||
_id: { $in: swimlanes },
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
_id: 1,
|
||||
title: 1,
|
||||
boardId: 1,
|
||||
type: 1,
|
||||
color: 1,
|
||||
sort: 1,
|
||||
},
|
||||
// sort: {
|
||||
// sort: ['boardId', 'listId', 'sort'],
|
||||
// },
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Meteor.publish('myLists', function() {
|
||||
const userId = this.userId;
|
||||
const lists = [];
|
||||
|
||||
Cards.find({
|
||||
archived: false,
|
||||
$or: [{ members: userId }, { assignees: userId }],
|
||||
}).forEach(card => {
|
||||
lists.push(card.listId);
|
||||
});
|
||||
|
||||
return Lists.find(
|
||||
{
|
||||
// archived: false,
|
||||
_id: { $in: lists },
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
_id: 1,
|
||||
boardId: 1,
|
||||
swimlaneId: 1,
|
||||
title: 1,
|
||||
color: 1,
|
||||
type: 1,
|
||||
sort: 1,
|
||||
},
|
||||
// sort: {
|
||||
// sort: ['boardId', 'listId', 'sort'],
|
||||
// },
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Meteor.publish('archivedBoards', function() {
|
||||
const userId = this.userId;
|
||||
if (!Match.test(userId, String)) return [];
|
||||
|
|
|
|||
|
|
@ -4,33 +4,76 @@ Meteor.publish('card', cardId => {
|
|||
});
|
||||
|
||||
Meteor.publish('myCards', function() {
|
||||
const userId = this.userId;
|
||||
const userId = Meteor.userId();
|
||||
|
||||
return Cards.find(
|
||||
{
|
||||
archived: false,
|
||||
$or: [{ members: userId }, { assignees: userId }],
|
||||
const archivedBoards = [];
|
||||
Boards.find({ archived: true }).forEach(board => {
|
||||
archivedBoards.push(board._id);
|
||||
});
|
||||
|
||||
const archivedSwimlanes = [];
|
||||
Swimlanes.find({ archived: true }).forEach(swimlane => {
|
||||
archivedSwimlanes.push(swimlane._id);
|
||||
});
|
||||
|
||||
const archivedLists = [];
|
||||
Lists.find({ archived: true }).forEach(list => {
|
||||
archivedLists.push(list._id);
|
||||
});
|
||||
|
||||
selector = {
|
||||
archived: false,
|
||||
boardId: { $nin: archivedBoards },
|
||||
swimlaneId: { $nin: archivedSwimlanes },
|
||||
listId: { $nin: archivedLists },
|
||||
$or: [{ members: userId }, { assignees: userId }],
|
||||
};
|
||||
|
||||
const cards = Cards.find(selector, {
|
||||
fields: {
|
||||
_id: 1,
|
||||
archived: 1,
|
||||
boardId: 1,
|
||||
swimlaneId: 1,
|
||||
listId: 1,
|
||||
title: 1,
|
||||
type: 1,
|
||||
sort: 1,
|
||||
members: 1,
|
||||
assignees: 1,
|
||||
colors: 1,
|
||||
dueAt: 1,
|
||||
},
|
||||
{
|
||||
fields: {
|
||||
_id: 1,
|
||||
archived: 1,
|
||||
boardId: 1,
|
||||
swimlaneId: 1,
|
||||
listId: 1,
|
||||
title: 1,
|
||||
type: 1,
|
||||
sort: 1,
|
||||
members: 1,
|
||||
assignees: 1,
|
||||
colors: 1,
|
||||
dueAt: 1,
|
||||
},
|
||||
// sort: {
|
||||
// sort: ['boardId', 'listId', 'sort'],
|
||||
// },
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const boards = [];
|
||||
const swimlanes = [];
|
||||
const lists = [];
|
||||
const users = [];
|
||||
|
||||
cards.forEach(card => {
|
||||
if (card.boardId) boards.push(card.boardId);
|
||||
if (card.swimlaneId) swimlanes.push(card.swimlaneId);
|
||||
if (card.listId) lists.push(card.listId);
|
||||
if (card.members) {
|
||||
card.members.forEach(userId => {
|
||||
users.push(userId);
|
||||
});
|
||||
}
|
||||
if (card.assignees) {
|
||||
card.assignees.forEach(userId => {
|
||||
users.push(userId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return [
|
||||
cards,
|
||||
Boards.find({ _id: { $in: boards } }),
|
||||
Swimlanes.find({ _id: { $in: swimlanes } }),
|
||||
Lists.find({ _id: { $in: lists } }),
|
||||
Users.find({ _id: { $in: users } }),
|
||||
];
|
||||
});
|
||||
|
||||
Meteor.publish('dueCards', function(allUsers = false) {
|
||||
|
|
@ -105,11 +148,22 @@ Meteor.publish('dueCards', function(allUsers = false) {
|
|||
const boards = [];
|
||||
const swimlanes = [];
|
||||
const lists = [];
|
||||
const users = [];
|
||||
|
||||
cards.forEach(card => {
|
||||
if (card.boardId) boards.push(card.boardId);
|
||||
if (card.swimlaneId) swimlanes.push(card.swimlaneId);
|
||||
if (card.listId) lists.push(card.listId);
|
||||
if (card.members) {
|
||||
card.members.forEach(userId => {
|
||||
users.push(userId);
|
||||
});
|
||||
}
|
||||
if (card.assignees) {
|
||||
card.assignees.forEach(userId => {
|
||||
users.push(userId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return [
|
||||
|
|
@ -117,6 +171,7 @@ Meteor.publish('dueCards', function(allUsers = false) {
|
|||
Boards.find({ _id: { $in: boards } }),
|
||||
Swimlanes.find({ _id: { $in: swimlanes } }),
|
||||
Lists.find({ _id: { $in: lists } }),
|
||||
Users.find({ _id: { $in: users } }),
|
||||
];
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue