Merge pull request #2 from mgrove36/add-location-transformations

Add location transformations & update comment
This commit is contained in:
Yung Wood
2024-09-01 22:31:24 +09:30
committed by GitHub

View File

@@ -151,7 +151,7 @@ func (filter Filter) matchesEvent(event ics.VEvent) bool {
}
}
// Check Description filters against VEvent
// Check Location filters against VEvent
if filter.Match.Location.hasConditions() {
eventLocation := event.GetProperty(ics.ComponentPropertyLocation)
if eventLocation == nil {
@@ -186,6 +186,13 @@ func (filter Filter) transformEvent(event *ics.VEvent) {
} else if filter.Transform.Description.Replace != "" {
event.SetDescription(filter.Transform.Description.Replace)
}
// Location transformations
if filter.Transform.Location.Remove {
event.SetLocation("")
} else if filter.Transform.Location.Replace != "" {
event.SetLocation(filter.Transform.Location.Replace)
}
}
// EventMatchRules contains VEvent properties that user can match against