-
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Regex doesn't filter multiple entries #787
Comments
Hey @seahindeniz 👋, I'm here to help you with your MeetingBar issue. Let's get this sorted out together! To address the issue where the regex filter only filters out the first matching event in MeetingBar, you need to modify the filtering logic in the In the func filterEvents(_ events: [MBEvent]) -> [MBEvent] {
var filteredCalendarEvents: [MBEvent] = []
for calendarEvent in events {
var isFiltered = false
// Filter events based on custom user regexes
for pattern in Defaults[.filterEventRegexes] {
if let regex = try? NSRegularExpression(pattern: pattern) {
let hasMatch = regex.firstMatch(in: calendarEvent.title, range: NSRange(calendarEvent.title.startIndex..., in: calendarEvent.title)) != nil
if hasMatch {
isFiltered = true
break // Exit the inner loop if a match is found
}
}
}
if isFiltered {
continue // Skip this event if it matches any regex
}
// The rest of the filtering logic remains unchanged
if calendarEvent.isAllDay {
// Filter all day events
switch Defaults[.allDayEvents] {
case .show:
break
case .show_with_meeting_link_only:
if calendarEvent.meetingLink?.url == nil {
continue // Skip this event
}
case .hide:
continue // Skip this event
}
} else {
// Filter not for all day events
switch Defaults[.nonAllDayEvents] {
case .show, .show_inactive_without_meeting_link:
break
case .hide_without_meeting_link:
if calendarEvent.meetingLink?.url == nil {
continue // Skip this event
}
}
}
// Filter pending events
switch Defaults[.showPendingEvents] {
case .show, .show_inactive, .show_underlined:
break
case .hide:
if calendarEvent.participationStatus == .pending {
continue // Skip this event
}
}
// Filter tentative events
switch Defaults[.showTentativeEvents] {
case .show, .show_inactive, .show_underlined:
break
case .hide:
if calendarEvent.participationStatus == .tentative {
continue // Skip this event
}
}
filteredCalendarEvents.append(calendarEvent)
}
return filteredCalendarEvents
} This change ensures that all events matching any of the regex patterns are filtered, not just the first one [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
macOS version
15.1
MeetingBar version
4.10.0
Installation source
manually
Calendars provider
Google Calendar
Bug description
I have multiple slots with the same name in my calendar. I sed the regex filter but it only filters out the first match.
Reproduction steps
Expected behavior
The filter should be used for all entries expect the first match
Screenshots/screen recordings
Before the filter:
After:
Additional context
I believe this is related to this line, but I'm not sure
MeetingBar/MeetingBar/EventStores/Event.swift
Lines 179 to 180 in 25d2184
The text was updated successfully, but these errors were encountered: