Files
wekan/client/lib/boardTextFilter.js
Lauri Ojansivu 0bf2dc27be Filter cards by titles descriptions checklists and comments
Match literal text across the authorized board, including cards outside lazy windows. Publish only matching IDs, refresh on content and access changes, and release observers when filters change. Verify the batched join, cancellation and permission races, and actual Chromium behavior.

Thanks to neooleg and xet7 !
2026-09-28 18:13:46 +03:00

20 lines
774 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
const matches = new Mongo.Collection('boardTextMatches');
export function boardTextSelector(term) {
const boardId = Session.get('currentBoard');
return { _id: { $in: matches.find({ boardId, term }, { fields: { cardId: 1 } }).fetch().map(row => row.cardId) } };
}
export function startBoardTextFilter(filter) {
Meteor.startup(() => Tracker.autorun(computation => {
const boardId = Session.get('currentBoard'), term = filter.value();
if (boardId && term) {
const handle = Meteor.subscribe('boardTextMatches', boardId, term);
computation.onInvalidate(() => handle.stop());
}
}));
}