fix: Improve calendar invite detection and fix DuplicateIds error
- Enhance is_calendar_email() to detect forwarded meeting invites - Add content-based detection for Teams meetings and ICS data - Remove fixed ID from CalendarInvitePanel to prevent DuplicateIds - Fix notify calls in calendar_invite.py (remove call_from_thread)
This commit is contained in:
@@ -195,13 +195,12 @@ async def _async_respond_to_invite(
|
||||
):
|
||||
"""Async worker to find and respond to calendar invite."""
|
||||
# First, find the event
|
||||
app.call_from_thread(app.notify, f"Searching for calendar event: {subject[:40]}...")
|
||||
app.notify(f"Searching for calendar event: {subject[:40]}...")
|
||||
|
||||
event = await find_event_by_subject(subject, organizer_email)
|
||||
|
||||
if not event:
|
||||
app.call_from_thread(
|
||||
app.notify,
|
||||
app.notify(
|
||||
f"Could not find calendar event matching: {subject[:40]}",
|
||||
severity="warning",
|
||||
)
|
||||
@@ -209,8 +208,7 @@ async def _async_respond_to_invite(
|
||||
|
||||
event_id = event.get("id")
|
||||
if not event_id:
|
||||
app.call_from_thread(
|
||||
app.notify,
|
||||
app.notify(
|
||||
"Could not get event ID from calendar",
|
||||
severity="error",
|
||||
)
|
||||
@@ -220,18 +218,14 @@ async def _async_respond_to_invite(
|
||||
|
||||
# Check if already responded
|
||||
if current_response == "accepted" and response == "accept":
|
||||
app.call_from_thread(
|
||||
app.notify, "Already accepted this invite", severity="information"
|
||||
)
|
||||
app.notify("Already accepted this invite", severity="information")
|
||||
return
|
||||
elif current_response == "declined" and response == "decline":
|
||||
app.call_from_thread(
|
||||
app.notify, "Already declined this invite", severity="information"
|
||||
)
|
||||
app.notify("Already declined this invite", severity="information")
|
||||
return
|
||||
|
||||
# Respond to the invite
|
||||
success, message = await respond_to_calendar_invite(event_id, response)
|
||||
|
||||
severity = "information" if success else "error"
|
||||
app.call_from_thread(app.notify, message, severity=severity)
|
||||
app.notify(message, severity=severity)
|
||||
|
||||
Reference in New Issue
Block a user