Skip to content

Commit 816fc8b

Browse files
committed
Standardize event IDs
1 parent 80b3da3 commit 816fc8b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

outlook/indico_outlook/calendar.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# them and/or modify them under the terms of the MIT License; see
66
# the LICENSE file for more details.
77

8+
from datetime import datetime
89
from pprint import pformat
10+
from urllib.parse import urlsplit
911

1012
import requests
1113
from markupsafe import Markup
@@ -14,6 +16,7 @@
1416
from werkzeug.datastructures import MultiDict
1517

1618
from indico.core import signals
19+
from indico.core.config import config
1720
from indico.core.db import db
1821
from indico.util.signals import values_from_signal
1922
from indico.util.string import strip_control_chars
@@ -113,7 +116,11 @@ def _update_calendar_entry(entry, settings):
113116
logger.debug('User %s has disabled calendar entries', user)
114117
return True
115118

116-
unique_id = '{}{}_{}'.format(settings['id_prefix'], user.id, entry.event_id)
119+
# Use common format for event calendar ID if the event was created on or after 2025-04-01
120+
if entry.event.created_dt >= datetime(2025, 4, 1):
121+
unique_id = f'indico-event-{entry.event_id}@{urlsplit(config.BASE_URL).hostname}'
122+
else:
123+
unique_id = '{}{}_{}'.format(settings['id_prefix'], user.id, entry.event_id)
117124
path = f'/api/v1/users/{user.email}/events/{unique_id}'
118125
url = settings['service_url'].rstrip('/') + path
119126
if entry.action in {OutlookAction.add, OutlookAction.update}:

0 commit comments

Comments
 (0)