Skip to content

Fix: excludedEvents matches substrings like the default calendar module (#55)#97

Merged
randomBrainstormer merged 1 commit into
mainfrom
fix/excluded-events-substring-match
Jun 5, 2026
Merged

Fix: excludedEvents matches substrings like the default calendar module (#55)#97
randomBrainstormer merged 1 commit into
mainfrom
fix/excluded-events-substring-match

Conversation

@randomBrainstormer

Copy link
Copy Markdown
Owner

Problem

Reported in #55 (and re-confirmed by a second user in 2025): excludedEvents entries don't hide matching events. Custom events work fine — only exclusion is broken.

Root cause

filterEvent() did:

this.config.excludedEvents.includes(event.summary)

Array.includes() is an exact, case-sensitive, full-title equality check. So excludedEvents: ["Birthday"] only hides an event titled exactly Birthday — never John's Birthday or birthday party. Users coming from the default MagicMirror calendar module expect case-insensitive substring matching (and the object form), which is what they configured for.

Fix

New isEventExcluded(title) helper that mirrors the default calendar module's semantics. Each excludedEvents entry may be:

  • a plain string → case-insensitive substring match, or
  • an object { filterBy, caseSensitive, regex } → case-sensitive and/or regex matching.

Also guards against private events (no summary) and empty/invalid filter entries.

excludedEvents: [
  "Birthday",                                  // hides any title containing "birthday"
  { filterBy: "Standup", caseSensitive: true },// exact-case substring
  { filterBy: "^\\[private\\]", regex: true }  // regex
]

Test plan

  • npx jest — 29/29 pass (7 new tests: substring, exact, case-sensitive, regex, no-summary, invalid entries)
  • Configure excludedEvents: ["Birthday"] and confirm "John's Birthday" no longer shows

Note: version intentionally not bumped — the auto-bump workflow handles it on merge.

Closes #55

…module

Issue #55: excluded events were still showing. filterEvent() used
this.config.excludedEvents.includes(event.summary), an exact,
case-sensitive, full-title equality check. So a filter like "Birthday"
never matched "John's Birthday".

Replace it with isEventExcluded(), which mirrors the default MagicMirror
calendar module: each entry is either a plain string (case-insensitive
substring match) or an object { filterBy, caseSensitive, regex }. Guards
against private events (no summary) and empty/invalid filter entries.

Adds unit tests covering substring, exact, case-sensitive, regex, the
no-summary case, and invalid entries.
@randomBrainstormer randomBrainstormer merged commit 016eb8c into main Jun 5, 2026
@randomBrainstormer randomBrainstormer deleted the fix/excluded-events-substring-match branch June 5, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ecluded events still showing

1 participant