From 1b6301fee7538560f02eb7246c7cb8eaf5830cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 28 Dec 2023 16:01:05 +0100 Subject: [PATCH] Use 'schema' alias for schema.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../object_validators/common_fields.ex | 15 --------------- .../object_validators/event_validator.ex | 12 +++++++++++- priv/static/schemas/litepub-0.1.jsonld | 16 ++++++++-------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validators/common_fields.ex b/lib/pleroma/web/activity_pub/object_validators/common_fields.ex index 2aa0678fcf..b38e1a6ab8 100644 --- a/lib/pleroma/web/activity_pub/object_validators/common_fields.ex +++ b/lib/pleroma/web/activity_pub/object_validators/common_fields.ex @@ -68,19 +68,4 @@ defmacro status_object_fields do field(:announcements, {:array, ObjectValidators.ObjectID}, default: []) end end - - defmacro event_object_fields do - quote bind_quoted: binding() do - field(:startTime, ObjectValidators.DateTime) - field(:endTime, ObjectValidators.DateTime) - - field(:joinMode, :string, default: "free") - - embeds_one(:location, PlaceValidator) - - field(:participation_count, :integer, default: 0) - field(:participations, {:array, ObjectValidators.ObjectID}, default: []) - field(:participation_request_count, :integer, default: 0) - end - end end diff --git a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex index 46cdaa0a29..9c813bccaa 100644 --- a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex @@ -22,9 +22,19 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EventValidator do message_fields() object_fields() status_object_fields() - event_object_fields() end end + + field(:startTime, ObjectValidators.DateTime) + field(:endTime, ObjectValidators.DateTime) + + field(:joinMode, :string, default: "free") + + embeds_one(:location, PlaceValidator) + + field(:participation_count, :integer, default: 0) + field(:participations, {:array, ObjectValidators.ObjectID}, default: []) + field(:participation_request_count, :integer, default: 0) end def cast_and_apply(data) do diff --git a/priv/static/schemas/litepub-0.1.jsonld b/priv/static/schemas/litepub-0.1.jsonld index 4e5c778657..df377cd189 100644 --- a/priv/static/schemas/litepub-0.1.jsonld +++ b/priv/static/schemas/litepub-0.1.jsonld @@ -55,16 +55,16 @@ }, "participationMessage": { "@id": "mz:participationMessage", - "@type": "sc:Text" + "@type": "schema:Text" }, - "streetAddress": "sc:streetAddress", - "postalCode": "sc:postalCode", - "addressLocality": "sc:addressLocality", - "addressRegion": "sc:addressRegion", - "addressCountry": "sc:addressCountry", + "streetAddress": "schema:streetAddress", + "postalCode": "schema:postalCode", + "addressLocality": "schema:addressLocality", + "addressRegion": "schema:addressRegion", + "addressCountry": "schema:addressCountry", "location": { - "@id": "sc:location", - "@type": "sc:Place" + "@id": "schema:location", + "@type": "schema:Place" } } ]