From d07faaa1dc61332511960c65da6556f4a69e25aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Menrath?=
Date: Sun, 19 Nov 2023 20:46:54 +0100
Subject: [PATCH] remove old activitypub_support_post_types setting
---
includes/class-activitypub.php | 4 ++--
includes/class-admin.php | 10 ----------
includes/rest/class-outbox.php | 2 +-
templates/settings.php | 20 --------------------
4 files changed, 3 insertions(+), 33 deletions(-)
diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php
index 24228f4..0b768a7 100644
--- a/includes/class-activitypub.php
+++ b/includes/class-activitypub.php
@@ -20,9 +20,9 @@ class Activitypub {
\add_filter( 'get_comment_link', array( self::class, 'remote_comment_link' ), 11, 3 );
// Add support for ActivityPub to custom post types
- $post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array();
+ $transformer_mapping = \get_option( 'activitypub_transformer_mapping', array( 'post' => 'activitypub/default', 'page' => 'activitypub/default' ) ) ? \get_option( 'activitypub_transformer_mapping', array( 'post' => 'activitypub/default', 'page' => 'activitypub/default' ) ) : array();
- foreach ( $post_types as $post_type ) {
+ foreach ( array_keys( $transformer_mapping ) as $post_type ) {
\add_post_type_support( $post_type, 'activitypub' );
}
diff --git a/includes/class-admin.php b/includes/class-admin.php
index dbafea2..718e1c6 100644
--- a/includes/class-admin.php
+++ b/includes/class-admin.php
@@ -159,16 +159,6 @@ class Admin {
'default' => '0',
)
);
- \register_setting(
- 'activitypub',
- 'activitypub_support_post_types',
- array(
- 'type' => 'string',
- 'description' => \esc_html__( 'Enable ActivityPub support for post types', 'activitypub' ),
- 'show_in_rest' => true,
- 'default' => array( 'post', 'pages' ),
- )
- );
/**
* Flexible activation of post_types together with mapping ActivityPub transformers.
diff --git a/includes/rest/class-outbox.php b/includes/rest/class-outbox.php
index 4dbd81a..4dab13e 100644
--- a/includes/rest/class-outbox.php
+++ b/includes/rest/class-outbox.php
@@ -59,7 +59,7 @@ class Outbox {
return $user;
}
- $post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) );
+ $post_types = array_keys( \get_option( 'activitypub_transformer_mapping', array( 'post' => 'activitypub/default', 'page' => 'activitypub/default') ) );
$page = $request->get_param( 'page', 1 );
diff --git a/templates/settings.php b/templates/settings.php
index f2993a0..91a35fa 100644
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -201,26 +201,6 @@
-
- |
-
-
- |
-
|