mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Match any recorded list, swimlane or incoming board move within inclusive local-day bounds, regardless of later moves. Reuse the authorized reactive ID publication for text and history, preserve lazy-loading coverage and validate history joins and live UI behavior. Thanks to neooleg and xet7 !
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { check, Match } from 'meteor/check';
|
|
import Cards from '/models/cards';
|
|
import Activities from '/models/activities';
|
|
import { cardMovementRange, CARD_MOVEMENT_EVENTS } from '/models/lib/cardMovementRange';
|
|
import { boardMovementSearch } from '/server/lib/boardMovementSearch';
|
|
import { publishBoardMatches } from '/server/lib/publishBoardMatches';
|
|
|
|
Meteor.publish('boardMovementMatches', async function(boardId, start, end) {
|
|
check(boardId, String); check(start, Match.OneOf(Number, null)); check(end, Match.OneOf(Number, null));
|
|
if (!boardId || !cardMovementRange(start, end)) return this.ready();
|
|
const rangeKey = JSON.stringify([start, end]);
|
|
return publishBoardMatches({ publication: this, boardId, key: rangeKey, identity: { rangeKey },
|
|
collectionName: 'boardMovementMatches',
|
|
children: [{ model: Activities, fields: { activityType: 1, createdAt: 1 },
|
|
selector: { activityType: { $in: CARD_MOVEMENT_EVENTS } } }],
|
|
findMatches: ({ scope, stopped }) => boardMovementSearch({ cards: Cards.rawCollection(),
|
|
activities: Activities.rawCollection(), scope, start, end, stopped }),
|
|
});
|
|
});
|