Fix: excludedEvents matches substrings like the default calendar module (#55)#97
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reported in #55 (and re-confirmed by a second user in 2025):
excludedEventsentries don't hide matching events. Custom events work fine — only exclusion is broken.Root cause
filterEvent()did:Array.includes()is an exact, case-sensitive, full-title equality check. SoexcludedEvents: ["Birthday"]only hides an event titled exactlyBirthday— neverJohn's Birthdayorbirthday 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. EachexcludedEventsentry may be:{ filterBy, caseSensitive, regex }→ case-sensitive and/or regex matching.Also guards against private events (no
summary) and empty/invalid filter entries.Test plan
npx jest— 29/29 pass (7 new tests: substring, exact, case-sensitive, regex, no-summary, invalid entries)excludedEvents: ["Birthday"]and confirm "John's Birthday" no longer showsNote: version intentionally not bumped — the auto-bump workflow handles it on merge.
Closes #55