From d7c4f5ae397a1baef2681f29fc6d8dc1677b3d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 28 Sep 2024 16:49:39 +0200 Subject: [PATCH 1/4] set site timezone as default in event base transformer --- includes/activitypub/transformer/class-event.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/activitypub/transformer/class-event.php b/includes/activitypub/transformer/class-event.php index 893778f..03c9fd2 100644 --- a/includes/activitypub/transformer/class-event.php +++ b/includes/activitypub/transformer/class-event.php @@ -276,6 +276,16 @@ abstract class Event extends Post { return $template; } + /** By default set the timezone of the WordPress site. + * + * This is likely to be overwritten by the actual transformer. + * + * @return string The timezone string of the site. + */ + public function get_timezone(): string { + return wp_timezone_string(); + } + /** * Generic function that converts an WP-Event object to an ActivityPub-Event object. * -- 2.39.5 From 4ff31c6b45580c7a0d8b3355f51625869a447d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 28 Sep 2024 19:52:48 +0200 Subject: [PATCH 2/4] add timezone for the events calendar --- .../transformer/class-the-events-calendar.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php index eea12ac..7d6eb1a 100644 --- a/includes/activitypub/transformer/class-the-events-calendar.php +++ b/includes/activitypub/transformer/class-the-events-calendar.php @@ -197,6 +197,17 @@ final class The_Events_Calendar extends Event { return $location; } + /** By default set the timezone of the WordPress site. + * + * This is likely to be overwritten by the actual transformer. + * + * @return string The timezone string of the site. + */ + public function get_timezone(): string { + return $this->tribe_event->timezone; + } + + /** * Extend the default event transformers to_object function. * -- 2.39.5 From 1153bce8e26e9870f3b7fd9b14f2aeb2f90af91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 28 Sep 2024 23:05:42 +0200 Subject: [PATCH 3/4] fix tags being in nested arrays --- includes/activitypub/transformer/class-the-events-calendar.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php index 7d6eb1a..c3d56e4 100644 --- a/includes/activitypub/transformer/class-the-events-calendar.php +++ b/includes/activitypub/transformer/class-the-events-calendar.php @@ -65,7 +65,7 @@ final class The_Events_Calendar extends Event { $tags[] = $tag; } } - $tags[] = parent::get_tag(); + $tags = array_merge( $tags, parent::get_tag() ); return $tags; } @@ -193,6 +193,7 @@ final class The_Events_Calendar extends Event { } $location->set_id( $venue->permalink ); $location->set_name( $venue->post_title ); + $location->set_sensitive( null ); return $location; } -- 2.39.5 From c8eedafb1369eefc5d5df52132db7fb11557682d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sun, 29 Sep 2024 11:02:44 +0200 Subject: [PATCH 4/4] add status to tribe --- includes/activitypub/transformer/class-the-events-calendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php index c3d56e4..97a1689 100644 --- a/includes/activitypub/transformer/class-the-events-calendar.php +++ b/includes/activitypub/transformer/class-the-events-calendar.php @@ -94,7 +94,7 @@ final class The_Events_Calendar extends Event { * * @return string status of the event */ - public function get_tribe_status() { + public function get_status() { if ( 'canceled' === $this->tribe_event->event_status ) { return 'CANCELLED'; } -- 2.39.5