77from couchers .config import config
88from couchers .email .rendering import get_emails_i18next
99from couchers .i18n import LocalizationContext
10- from couchers .proto .internal .jobs_pb2 import EmailAttachment
10+ from couchers .proto .internal .jobs_pb2 import EmailAttachmentV2
1111from couchers .proto .requests_pb2 import HostRequest
1212
1313HOST_REQUEST_ICS_FILENAME = "host_request.ics"
1414
1515
1616def create_host_request_attachment (
1717 host_request : HostRequest , other_name : str , hosting : bool , loc_context : LocalizationContext
18- ) -> EmailAttachment :
18+ ) -> EmailAttachmentV2 :
1919 calendar = create_host_request_calendar (host_request , other_name , hosting , loc_context )
2020 return calendar_to_attachment (calendar , HOST_REQUEST_ICS_FILENAME )
2121
@@ -67,7 +67,7 @@ def create_host_request_event(
6767
6868def create_host_request_cancellation_attachment (
6969 host_request : HostRequest , other_name : str , hosting : bool , loc_context : LocalizationContext
70- ) -> EmailAttachment :
70+ ) -> EmailAttachmentV2 :
7171 calendar = create_host_request_cancellation_calendar (host_request , other_name , hosting , loc_context )
7272 return calendar_to_attachment (calendar , HOST_REQUEST_ICS_FILENAME )
7373
@@ -96,7 +96,7 @@ def event_to_calendar(event: Event, method: str | None, loc_context: Localizatio
9696 return calendar
9797
9898
99- def calendar_to_attachment (calendar : Calendar , filename : str ) -> EmailAttachment :
99+ def calendar_to_attachment (calendar : Calendar , filename : str ) -> EmailAttachmentV2 :
100100 data = calendar .serialize ().encode ("utf-8" )
101101 content_disposition = f'attachment; filename="{ filename } "'
102102 content_type = 'text/calendar; charset="utf-8"'
@@ -105,7 +105,7 @@ def calendar_to_attachment(calendar: Calendar, filename: str) -> EmailAttachment
105105 # AI recommends avoiding quotes on this parameter for backwards compatibility with old email clients.
106106 content_type += f"; method={ calendar .method } "
107107
108- return EmailAttachment (data = data , content_disposition = content_disposition , content_type = content_type )
108+ return EmailAttachmentV2 (data = data , content_disposition = content_disposition , content_type = content_type )
109109
110110
111111def get_host_request_event_uid (host_request_id : int ) -> str :
0 commit comments