Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions plugins/apple-calendar/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,21 @@ async fn _sync_events(
continue;
}

// don't create a new recurring event if it already exists in the database with the same start date, tracking_id, name and is_recurring
// only for backward compatibility with the old database structure
let already_exists_in_db_recurring =
db_events_with_session.iter().any(|(db_event, session)| {
(db_event.start_date == system_event.start_date)
&& (db_event.tracking_id == system_event.id)
&& (system_event.is_recurring)
&& (db_event.name == system_event.name)
&& (db_event.is_recurring == false)
&& session.as_ref().map_or(false, |s| !s.is_empty())
});
if already_exists_in_db_recurring {
continue;
}

// This is a genuinely new event
let new_event = hypr_db_user::Event {
id: uuid::Uuid::new_v4().to_string(),
Expand Down
Loading