mirror of
https://github.com/wekan/wekan.git
synced 2026-02-09 17:54:21 +01:00
Merge pull request #3708 from jrsupplee/issue-3698
Bug fix for issue #3698
This commit is contained in:
commit
e709094533
5 changed files with 104 additions and 176 deletions
|
|
@ -56,10 +56,20 @@ Meteor.publish('card', cardId => {
|
|||
});
|
||||
|
||||
Meteor.publish('myCards', function(sessionId) {
|
||||
check(sessionId, String);
|
||||
|
||||
const queryParams = new QueryParams();
|
||||
queryParams.addPredicate(OPERATOR_USER, Meteor.user().username);
|
||||
queryParams.setPredicate(OPERATOR_LIMIT, 200);
|
||||
|
||||
return findCards(sessionId, buildQuery(queryParams));
|
||||
const query = buildQuery(queryParams);
|
||||
query.projection.sort = {
|
||||
boardId: 1,
|
||||
swimlaneId: 1,
|
||||
listId: 1,
|
||||
};
|
||||
|
||||
return findCards(sessionId, query);
|
||||
});
|
||||
|
||||
// Meteor.publish('dueCards', function(sessionId, allUsers = false) {
|
||||
|
|
@ -444,16 +454,18 @@ function buildSelector(queryParams) {
|
|||
|
||||
const query = new Query();
|
||||
query.selector = selector;
|
||||
query.params = queryParams;
|
||||
query.setQueryParams(queryParams);
|
||||
query._errors = errors;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
function buildProjection(query) {
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('query:', query);
|
||||
let skip = 0;
|
||||
if (query.params.skip) {
|
||||
skip = query.params.skip;
|
||||
if (query.getQueryParams().skip) {
|
||||
skip = query.getQueryParams().skip;
|
||||
}
|
||||
let limit = DEFAULT_LIMIT;
|
||||
const configLimit = parseInt(process.env.RESULTS_PER_PAGE, 10);
|
||||
|
|
@ -461,8 +473,8 @@ function buildProjection(query) {
|
|||
limit = configLimit;
|
||||
}
|
||||
|
||||
if (query.params.hasOperator(OPERATOR_LIMIT)) {
|
||||
limit = query.params.getPredicate(OPERATOR_LIMIT);
|
||||
if (query.getQueryParams().hasOperator(OPERATOR_LIMIT)) {
|
||||
limit = query.getQueryParams().getPredicate(OPERATOR_LIMIT);
|
||||
}
|
||||
|
||||
const projection = {
|
||||
|
|
@ -495,12 +507,13 @@ function buildProjection(query) {
|
|||
limit,
|
||||
};
|
||||
|
||||
if (query.params.hasOperator(OPERATOR_SORT)) {
|
||||
if (query.getQueryParams().hasOperator(OPERATOR_SORT)) {
|
||||
const order =
|
||||
query.params.getPredicate(OPERATOR_SORT).order === ORDER_ASCENDING
|
||||
query.getQueryParams().getPredicate(OPERATOR_SORT).order ===
|
||||
ORDER_ASCENDING
|
||||
? 1
|
||||
: -1;
|
||||
switch (query.params.getPredicate(OPERATOR_SORT).name) {
|
||||
switch (query.getQueryParams().getPredicate(OPERATOR_SORT).name) {
|
||||
case PREDICATE_DUE_AT:
|
||||
projection.sort = {
|
||||
dueAt: order,
|
||||
|
|
@ -627,6 +640,12 @@ function findCards(sessionId, query) {
|
|||
update.$set.resultsCount = update.$set.cards.length;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('sessionId:', sessionId);
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('userId:', userId);
|
||||
// eslint-disable-next-line no-console
|
||||
// console.log('update:', update);
|
||||
SessionData.upsert({ userId, sessionId }, update);
|
||||
|
||||
// remove old session data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue