add ical_status
Some checks failed
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Failing after 5s

This commit is contained in:
André Menrath 2023-12-03 11:41:13 +01:00
parent 1b2c63ef20
commit e91e76bf17
2 changed files with 13 additions and 11 deletions

View file

@ -130,6 +130,7 @@ class Event extends \Activitypub\Activity\Base_Object {
private function rename_ical_status_key( $array ) { private function rename_ical_status_key( $array ) {
$array[ 'ical:status' ] = $array[ 'icalStatus' ]; $array[ 'ical:status' ] = $array[ 'icalStatus' ];
unset( $array[ 'icalStatus' ] ); unset( $array[ 'icalStatus' ] );
return $array;
} }
/** /**
@ -137,7 +138,7 @@ class Event extends \Activitypub\Activity\Base_Object {
*/ */
public function rename_array_keys( $array ) { public function rename_array_keys( $array ) {
if ( isset( $array[ 'icalStatus' ] ) ) { if ( isset( $array[ 'icalStatus' ] ) ) {
$array = rename_ical_status_key( $array ); $array = $this->rename_ical_status_key( $array );
} }
return $array; return $array;
} }
@ -170,21 +171,21 @@ class Event extends \Activitypub\Activity\Base_Object {
} }
public function filter_context( $context ) { public function filter_context( $context ) {
if ( isset( $this->replies_moderation_option ) ) { // if ( isset( $this->replies_moderation_option ) ) {
$replies_moderation_option_context = $this->get_property_context( 'replies_moderation_option' ); // $replies_moderation_option_context = $this->get_property_context( 'replies_moderation_option' );
} // }
return $context; return $context;
} }
private static function compact_context( $key_context, $namespace, $abbreviation ) { private static function compact_context( $key_context, $namespace, $abbreviation ) {
$abbreviation_added = false; $abbreviation_added = false;
foreach ( $key_context as $key => $value ) { foreach ( $key_context as $key => $value ) {
// Check if the key starts with "https://joinpeertube.org/" // Check if the key starts with the namespace
if ( strpos( $value, $namespace ) === 0 ) { if ( strpos( $value, $namespace ) === 0 ) {
// Replace the key // Replace the key
$key_context[ $key ] = $abbreviation . ':' . substr( $value, strlen( $namespace ) ); $key_context[ $key ] = $abbreviation . ':' . substr( $value, strlen( $namespace ) );
// Add "pt" element only once // Add abbreviation element for the namespace only once
if ( ! $abbreviation_added ) { if ( ! $abbreviation_added ) {
$key_context = [ $abbreviation => $namespace . '/ns#' ] + $key_context; $key_context = [ $abbreviation => $namespace . '/ns#' ] + $key_context;
$abbreviation_added = true; $abbreviation_added = true;
@ -198,9 +199,9 @@ class Event extends \Activitypub\Activity\Base_Object {
$class = self::class; $class = self::class;
$transient = "activitypub_context_object_{$class}"; $transient = "activitypub_context_object_{$class}";
$context = get_transient($transient); $context = get_transient($transient);
if ( $context ) { // if ( $context ) {
return $context; // return $context;
} // }
$reflection_class = new ReflectionClass( self::class ); $reflection_class = new ReflectionClass( self::class );
$context = array( $context = array(
'https://www.w3.org/ns/activitystreams', 'https://www.w3.org/ns/activitystreams',

View file

@ -188,7 +188,8 @@ class VS_Event extends \Activitypub\Transformer\Base {
->set_tag( $this->get_tags() ) ->set_tag( $this->get_tags() )
->set_replies_moderation_option( 'allow_all' ) ->set_replies_moderation_option( 'allow_all' )
->set_join_mode( 'external' ) ->set_join_mode( 'external' )
->set_external_participation_url( $this->get_url() ); ->set_external_participation_url( $this->get_url() )
->set_ical_status( 'CONFIRMED' );
return $object; return $object;
} }