Files
wekan/models/lib/ruleTextContainsMatch.js
T
Lauri Ojansivu f1c0db247a CHANGELOG.md is the short changelog, written from CHANGELOG-big.md.
CHANGELOG-big.md is the changelog as it was: # Status, # Upcoming and every
release in full, with its <details> entries. Everything that writes or edits
the changelog uses it - release-all.sh, release-notes.sh and the release
workflow, the commit-link repair in build.sh and fix-changelog-hashes.sh,
the archive, the wrapper, the version scripts - and the release notes'
"More details at ChangeLog" link goes to its section. remote-release.py,
shared with FerretDB and the patch repositories, takes the file from its
config, and only WeKan's names CHANGELOG-big.md.

CHANGELOG.md is new: no Status and no Upcoming, only the In short paragraph
of each of the five newest releases and a link to its full section, in plain
Markdown - no <details>, <summary>, </summary> or </details>, and HTML links
written as Markdown links. releases/changelog-short.mjs writes it;
release-all.sh runs it right after naming the release, so it is in the
release commit, and changelog.sh does too. The Sandstorm App Market keeps
embedding CHANGELOG.md, now the short one.

old-CHANGELOG/'s headers say they moved out of CHANGELOG-big.md. References
to Upcoming or TODO Later in code comments and docs name CHANGELOG-big.md.
CLAUDE.md and AGENTS.md describe both files: CHANGELOG-big.md is written,
CHANGELOG.md is generated and never edited by hand.

tests/changelogShort.test.cjs: CHANGELOG.md is exactly what the generator
writes, the five newest releases with their whole In short, links that
resolve, and none of the four tags or an HTML link; the changelog tests
read CHANGELOG-big.md.

Thanks to xet7 !
2026-10-30 03:29:48 +02:00

38 lines
1.5 KiB
JavaScript

'use strict';
// #2194 "Card title/description contains {value}" rule trigger.
//
// WeKan's rules are single-trigger/single-condition today (see the #4294
// investigation noted in CHANGELOG-big.md's TODO Later - combining several
// conditions in one rule with AND is explicitly out of scope here and
// deferred). This module is the pure, testable decision for a SINGLE new
// trigger type: does a card's title or description contain a
// case-insensitive substring the user typed when creating the rule?
//
// Pure (no Meteor imports) so both server/rulesHelper.js and the unit tests
// share one implementation, the same discipline models/lib/ruleCardTitleFilter.js
// and server/lib/advancedFilterMatch.js already follow.
// Case-insensitive substring test. Returns false when either side is not a
// non-empty string - an unset trigger value never matches anything, and a
// card with no title/description (undefined/null) never matches either.
function textContainsMatch(text, needle) {
if (typeof needle !== 'string' || needle.trim() === '') return false;
if (typeof text !== 'string' || text === '') return false;
return text.toLowerCase().includes(needle.toLowerCase());
}
// Does the card (title and/or description) contain the trigger's substring?
function cardTextContainsMatch(card, needle) {
if (!card) return false;
return (
textContainsMatch(card.title, needle) ||
textContainsMatch(card.description, needle)
);
}
module.exports = {
textContainsMatch,
cardTextContainsMatch,
};