From a3c1c883be3a7d9ddc598390959059f0877a7467 Mon Sep 17 00:00:00 2001 From: Vidya Ramakrishnan Date: Wed, 29 Nov 2023 10:59:33 +0530 Subject: [PATCH 1/3] Update jsonld to include virtual location when event is missing a primary venue --- funnel/transports/email/send.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/funnel/transports/email/send.py b/funnel/transports/email/send.py index f31343c0c..040a14c4b 100644 --- a/funnel/transports/email/send.py +++ b/funnel/transports/email/send.py @@ -91,7 +91,10 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: } location['address'] = postal_address else: - location = rsvp.project.location + location = { + "@type": "VirtualLocation", + "url": rsvp.project.absolute_url, + } return { '@context': 'https://schema.org', '@type': 'EventReservation', @@ -116,6 +119,7 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: 'performer': { '@type': 'Organization', 'name': rsvp.project.account.title, + 'image': rsvp.project.account.logo_url }, }, 'numSeats': '1', From e31b96669c53d3dd454648567cdc0968dc23591d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 05:32:00 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- funnel/transports/email/send.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/funnel/transports/email/send.py b/funnel/transports/email/send.py index 040a14c4b..2c37a36e8 100644 --- a/funnel/transports/email/send.py +++ b/funnel/transports/email/send.py @@ -119,7 +119,7 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: 'performer': { '@type': 'Organization', 'name': rsvp.project.account.title, - 'image': rsvp.project.account.logo_url + 'image': rsvp.project.account.logo_url, }, }, 'numSeats': '1', From 3c0168a2db3f0f1bcfd4fb634af3abb9ab93c8cd Mon Sep 17 00:00:00 2001 From: Vidya Ramakrishnan Date: Wed, 29 Nov 2023 11:24:29 +0530 Subject: [PATCH 3/3] Add event attendance mode to jsonld --- funnel/transports/email/send.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/funnel/transports/email/send.py b/funnel/transports/email/send.py index 040a14c4b..7145cdf0d 100644 --- a/funnel/transports/email/send.py +++ b/funnel/transports/email/send.py @@ -74,6 +74,7 @@ def jsonld_confirm_action(description: str, url: str, title: str) -> dict[str, o def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: """Schema.org JSON-LD markup for an event reservation.""" location: str | dict[str, object] + event_mode: str venue = rsvp.project.primary_venue if venue is not None: location = { @@ -90,11 +91,13 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: 'addressCountry': venue.country, } location['address'] = postal_address + event_mode = "https://schema.org/OfflineEventAttendanceMode" else: location = { "@type": "VirtualLocation", "url": rsvp.project.absolute_url, } + event_mode = "https://schema.org/OnlineEventAttendanceMode" return { '@context': 'https://schema.org', '@type': 'EventReservation', @@ -106,6 +109,7 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: if rsvp.state.NO else 'https://schema.org/ReservationPending' ), + "eventAttendanceMode": event_mode, 'underName': { '@type': 'Person', 'name': rsvp.participant.fullname, @@ -122,6 +126,7 @@ def jsonld_event_reservation(rsvp: Rsvp) -> dict[str, object]: 'image': rsvp.project.account.logo_url }, }, + 'modifyReservationUrl': rsvp.project.absolute_url, 'numSeats': '1', }